From: Graham Leggett Date: Mon, 22 Jul 2002 10:27:14 +0000 (+0000) Subject: Fix a resource leak where LDAP connections were not being returned X-Git-Tag: 2.0.40~162 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=553751a20e825c6c30ef40345ec4d94bcb02cbe9;p=thirdparty%2Fapache%2Fhttpd.git Fix a resource leak where LDAP connections were not being returned to the pool after being used. PR: Obtained from: Submitted by: Scott Lamb Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96142 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/experimental/mod_auth_ldap.c b/modules/experimental/mod_auth_ldap.c index 064484d5d7d..ce025b1ebed 100644 --- a/modules/experimental/mod_auth_ldap.c +++ b/modules/experimental/mod_auth_ldap.c @@ -196,6 +196,13 @@ void mod_auth_ldap_build_filter(char *filtbuf, strcat(filtbuf, "))"); } +static apr_status_t mod_auth_ldap_cleanup_connection_close(void *param) +{ + util_ldap_connection_t *ldc = param; + util_ldap_connection_close(ldc); + return APR_SUCCESS; +} + /* * Authentication Phase @@ -361,6 +368,9 @@ int mod_auth_ldap_auth_checker(request_rec *r) ldc = util_ldap_connection_find(r, sec->host, sec->port, sec->binddn, sec->bindpw, sec->deref, sec->netscapessl, sec->starttls); + apr_pool_cleanup_register(r->pool, ldc, + mod_auth_ldap_cleanup_connection_close, + apr_pool_cleanup_null); } else { ap_log_rerror(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, r,