compiling against OpenLDAP 2.0.11

Konstantin Chuguev Konstantin.Chuguev at
Thu Jul 12 11:31:53 CEST 2001

Hi Steffen,

Steffen Ries wrote:

> Michael Ströder <michael at> writes:
> > Anyone did notice the forwarded warning message by Stig about
> > possible memory leaks with OpenLDAP 2.0.x API?
> > Please glance over it:
> >
> I looked through it.
> The first issue (ldap_first_attribute) has changed from OpenLDAP 1.2
> to 2.0.x so that the memory is *never* freed by the library. In 1.1 it
> was freed, when the last attribute was read. However, the current
> python-ldap code did never free the memory. IOW, there is a possible
> memory leak in error cases.

> The second issue (ldap_get_dn) has *not* changed between OpenLDAP 1.2
> and 2.0.x, i.e. the same kind of memory leak exists for both API
> versions.

If we are going to release the latest snapshot without OpenLDAPv2 support
(which I think is a good idea), we would still like to eliminate any memory
leaks :-) In that case, could you please update your patch to do The Right
Thing (TM) for OpenLDAPv1 only? If you don't have enough time, I could do
it myself. I'd just like to get a hint in this case: is it only message.c
that needs to be patched?

> The attached patch should fix both issues. The last "ber_free()"
> should be surrounded by some #ifdef OPENLDAP_2_0_X conditional...
> I scanned through the documentation and did not notice any further
> changes in memory handling, but then again, I did not really look too
> hard.

After that, I would add memory leak fixes to my OpenLDAPv2 patches.


          * *        Konstantin Chuguev - Application Engineer
       *      *              Francis House, 112 Hills Road
     *                       Cambridge CB2 1PQ, United Kingdom
 D  A  N  T  E       WWW:

More information about the python-ldap mailing list