[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#4441) [PATCH] Mutex related memory leak in libldap



Full_Name: Xin LI
Version: OpenLDAP 2.3.20
OS: FreeBSD
URL: 
Submission from: (NULL) (61.135.152.194)


In libldap/open.c (ldap_create()), three mutexes were initialized, but in
unbind.c, only two were destroyed, thus a leak would happen.  The following
patch will plug the leak.

In order to trigger the issue, one should use the re-enterrent library and
repeatedly do initialize -> unbind and see.

Index: unbind.c
===================================================================
RCS file: /repo/OpenLDAP/pkg/ldap/libraries/libldap/unbind.c,v
retrieving revision 1.54
diff -u -r1.54 unbind.c
--- unbind.c	3 Jan 2006 22:12:09 -0000	1.54
+++ unbind.c	17 Mar 2006 09:43:46 -0000
@@ -194,6 +194,7 @@
 #ifdef LDAP_R_COMPILE
 	ldap_pvt_thread_mutex_destroy( &ld->ld_req_mutex );
 	ldap_pvt_thread_mutex_destroy( &ld->ld_res_mutex );
+	ldap_pvt_thread_mutex_destroy( &ld->ld_conn_mutex );
 #endif
 #ifndef NDEBUG
 	LDAP_TRASH(ld);