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

Fix for Memory Leak (ITS#217)

Full_Name: Tim Bowman
Version: 1.2.3
OS: Linux & NT
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (

There is a memory leak due to the global openldap_ldap_global_options struct
(in init.c) having two members ldo_defbase & ldo_defhost which are malloced if
an ldap.conf file is read.  This is a one-time allocation, so it's only a big
for OSs that don't free the memory.

I fixed it by cleaning them up in ldap_ld_free, since I am using a wrapper
that calls ldap_init for every connection.  This is kind of a bitch to fix if
want to unbind and bind after an init.  I first tried putting them on the stack
doing a strcpy instead of strdup, but the config file parsing function needs to
the right thing for those two cases.

Screwy API, Huh?  ldap needs an ldap_uninit to pair with ldap_init.