]> granicus.if.org Git - apache/commitdiff
Fix a resource leak where LDAP connections were not being returned
authorGraham Leggett <minfrin@apache.org>
Mon, 22 Jul 2002 10:27:14 +0000 (10:27 +0000)
committerGraham Leggett <minfrin@apache.org>
Mon, 22 Jul 2002 10:27:14 +0000 (10:27 +0000)
to the pool after being used.
PR:
Obtained from:
Submitted by: Scott Lamb <slamb@slamb.org>
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96142 13f79535-47bb-0310-9956-ffa450edef68

modules/experimental/mod_auth_ldap.c

index 064484d5d7d63dc15214c46a8a089f0d375e2d59..ce025b1ebedbd084d9bb6f901dddd5c0d03e63cf 100644 (file)
@@ -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,