Issue 1116 - Memory leak if connect/bind fails.
Summary: Memory leak if connect/bind fails.
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-04-14 04:39 UTC by mrsam@courier-mta.com
Modified: 2014-08-01 21:06 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description mrsam@courier-mta.com 2001-04-14 04:39:27 UTC
Full_Name: Sam Varshavchik
Version: 2.0.7
OS: Linux
URL: http://www.openldap.org/lists/openldap-bugs/200010/msg00210.html
Submission from: (NULL) (216.179.5.151)


I am seeing a memory leak when a connect or bind fails.  Initial report was
ITS#864  against 1.2.  The same test program from ITS#864 also leaks memory
under 2.0.7

However, with OpenLDAP 2.0.7 both a failed connection attempt case, or a bad
password, leaks memory.  In 1.2 only a failed connection leaked memory.



Comment 1 Stig Venaas 2001-04-21 10:46:59 UTC
On Sat, Apr 14, 2001 at 04:39:28AM +0000, mrsam@courier-mta.com wrote:
> Full_Name: Sam Varshavchik
> Version: 2.0.7
> OS: Linux
> URL: http://www.openldap.org/lists/openldap-bugs/200010/msg00210.html
> Submission from: (NULL) (216.179.5.151)
> 
> 
> I am seeing a memory leak when a connect or bind fails.  Initial report was
> ITS#864  against 1.2.  The same test program from ITS#864 also leaks memory
> under 2.0.7
> 
> However, with OpenLDAP 2.0.7 both a failed connection attempt case, or a bad
> password, leaks memory.  In 1.2 only a failed connection leaked memory.

I'll look into this.

Stig
Comment 2 Kurt Zeilenga 2001-04-23 05:51:11 UTC
moved from Incoming to Software Bugs
Comment 3 Kurt Zeilenga 2001-10-30 15:17:11 UTC
changed state Open to Feedback
Comment 4 jwm@horde.net 2001-10-30 21:35:33 UTC
I ran a malloc debugger on a program similar to Sam's; it appears to be
leaking in ldap_create(), specifically libraries/libldap/open.c:153 where
the SASL stuff is LDAP_STRDUP()'d.

I haven't had a good look through the OpenLDAP source, but I think I've got
a decent fix for simple binds at
http://horde.net/~jwm/openldap-unbind.patch. I'd like to thank Armin Biere
at ETHZ for his ccmalloc memory debugger; it was a great help in tracking
this down. www.inf.ethz.ch/personal/biere/projects/ccmalloc/

Lastly, I'd like to note that this is by no means the only place that will
leak in this manner. There are at least a couple instances of comments
stating "this value is leaked" in libraries/libldap/init.c, and might be
more in other places where there's SASL code. Someone with a vested interest
in the SASL code should give it a good going-over for more leaks like this.

Comment 5 jwm@horde.net 2001-11-02 16:59:24 UTC
I've updated the aforementioned URL to fix two additional leaks in the SASL
code. If you repeatedly bind and unbind (successfully), the SASL portion of
OpenLDAP leaks memory. This fixes that.

Comment 6 Kurt Zeilenga 2001-11-06 08:21:34 UTC
changed notes
changed state Feedback to Test
Comment 7 Kurt Zeilenga 2002-02-24 01:24:52 UTC
changed notes
changed state Test to Closed
Comment 8 Howard Chu 2002-05-02 22:31:16 UTC
changed notes
Comment 9 Kurt Zeilenga 2002-06-19 01:36:52 UTC
moved from Software Bugs to Archive.Software Bugs
Comment 10 OpenLDAP project 2014-08-01 21:06:56 UTC
applied to HEAD,
released in 2.0.19