Memory leaks with new LDAP API (the one in OpenLDAP 2.x.x)

Michael Ströder michael at
Mon Jun 25 12:37:21 CEST 2001


Find below one more important note about hasty patches for linking
python-ldap against OpenLDAP 2 libs.

Ciao, Michael.

-------- Original Message --------
Subject: Re: Thanx for helping me...
Date: Mon, 25 Jun 2001 12:19:04 +0200
From: Stig Venaas <Stig.Venaas at>
To: Michael Ströder <michael at>

One more thing. I've realized after looking more at the new
LDAP API (the one in OpenLDAP 2.x.x) that code using the old
API will compile and work just fine with the new API except
for one important thing. There will be memory leaks! So
people should be warned a bit against just using old applications
with OpenLDAP 2.x.x libs perhaps. The reason is changes in the
memory allocation. When using ldap_first_attribute and next
attribute, the attribute string must be freed, and one must also
free the ber structure used by those. Same holds for get_dn or
whatever it's called. I've just been fixing this in PHP.


More information about the python-ldap mailing list