[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: (ITS#9090) memory leak: ldap_unbind_* functions don't free 'ld_sb' field of LDAP structure
- To: openldap-its@OpenLDAP.org
- Subject: Re: (ITS#9090) memory leak: ldap_unbind_* functions don't free 'ld_sb' field of LDAP structure
- From: ondra@mistotebe.net
- Date: Mon, 30 Sep 2019 12:11:31 +0000
- Auto-submitted: auto-generated (OpenLDAP-ITS)
On Mon, Sep 30, 2019 at 11:04:08AM +0000, santucco@mail.ru wrote:
> 3. Run the test, analyze AddressSanitizer output:
> =================================================================
> ==29038==ERROR: LeakSanitizer: detected memory leaks
>
> Direct leak of 40 byte(s) in 1 object(s) allocated from:
> #0 0x7f9d35ac23a8 in __interceptor_calloc
> ../../../../libsanitizer/asan/asan_malloc_linux.cc:70
> #1 0x55d793627512 in ber_memcalloc_x (/tmp/test+0x67512)
> #2 0x55d79362757b in ber_memcalloc (/tmp/test+0x6757b)
> #3 0x55d793628a2d in ber_sockbuf_alloc (/tmp/test+0x68a2d)
> #4 0x55d7935ee453 in ldap_create (/tmp/test+0x2e453)
> #5 0x55d7935ee628 in ldap_initialize (/tmp/test+0x2e628)
> #6 0x55d7935ede8e in main /tmp/test.c:14
> #7 0x7f9d3442c3d4 in __libc_start_main (/lib64/libc.so.6+0x223d4)
>
> 4. Possible patch:
>
> --- openldap/libraries/libldap/unbind.c.orig 2019-07-23 17:46:22.000000000
> +0300
> +++ openldap/libraries/libldap/unbind.c 2019-09-27 15:39:40.000000000 +0300
> @@ -134,6 +134,8 @@
> /* Should already be closed by ldap_free_connection which knows not to free
> * this one */
> ber_int_sb_destroy( ld->ld_sb );
> + /* free memory to avoid of leak */
> + ber_memfree( ld->ld_sb );
>
> LDAP_MUTEX_LOCK( &ld->ld_ldopts_mutex );
Dear Alexander,
this looks like a duplicate of ITS#9081, fixed with commit
639e5f15fdeaf46941ec6da5c5d5f7ef707a976c.
Regards,
--
OndÅ?ej KuznÃk
Senior Software Engineer
Symas Corporation http://www.symas.com
Packaged, certified, and supported LDAP solutions powered by OpenLDAP