curl-library
RE: LDAP
Date: Wed, 15 Aug 2007 02:06:33 +0200
Hi all,
I see currently a memory leak with the LDAP stuff (although this was before with dynaload already, and even greater); the leak is proportional to the returned results (~ 200+ bytes per entry or so);
I compared with some samples from the Novell LDAP SDK, and found a free missing in our new ldap.c:
--- ldap.c.orig Mon Aug 13 18:37:52 2007
+++ ldap.c Wed Aug 15 01:58:26 2007
@@ -126,7 +126,7 @@
int rc = 0;
LDAP *server;
LDAPURLDesc *ludp = NULL;
- LDAPMessage *result;
+ LDAPMessage *result = NULL;
LDAPMessage *entryIterator;
int num = 0;
struct SessionHandle *data=conn->data;
@@ -245,6 +245,8 @@
LDAP_TRACE (("Received %d entries\n", num));
if (rc == LDAP_SIZELIMIT_EXCEEDED)
infof(data, "There are more than %d entries\n", num);
+ if (result)
+ ldap_msgfree(result);
if (ludp)
ldap_free_urldesc(ludp);
if (server)
with this patch the memory leak is gone for me; however I was too lazy to lookup if the ldap_msgfree() call is also the right thing for OpenLDAP - can someone please check this, and comment?
greetz, Guen.
Received on 2007-08-15