From 553751a20e825c6c30ef40345ec4d94bcb02cbe9 Mon Sep 17 00:00:00 2001 From: Graham Leggett Date: Mon, 22 Jul 2002 10:27:14 +0000 Subject: [PATCH] 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 --- modules/experimental/mod_auth_ldap.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/experimental/mod_auth_ldap.c b/modules/experimental/mod_auth_ldap.c index 064484d5d7..ce025b1ebe 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, -- 2.40.0