https://bugs.openldap.org/show_bug.cgi?id=9299
Issue ID: 9299 Summary: Memory leaks in ldap_simple_bind_s Product: OpenLDAP Version: 2.4.49 Hardware: x86_64 OS: Windows Status: UNCONFIRMED Severity: normal Priority: --- Component: libraries Assignee: bugs@openldap.org Reporter: Ritu.Varkey@microfocus.com Target Milestone: ---
Created attachment 747 --> https://bugs.openldap.org/attachment.cgi?id=747&action=edit Sample code with call to bind API
The call to ldap_simple_bind_s API leaks memory. Even after calling ldap_unbind_s or ldap_unbind_ext memory is not getting freed. Our application uses this API every time we make a connection to the directory. The API is being used on Windows operating system.
https://bugs.openldap.org/show_bug.cgi?id=9299
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Quanah Gibson-Mount quanah@openldap.org --- Hello,
The error is in the code you provided.
At line 86 you create an ld with ldap_open:
ld = ldap_open("10.71.130.106", 1636);
At line 88, you overwrite that ld with a new one from ldap_initialize:
err = ldap_initialize(&ld, uri.c_str());
This is the source of your leak.
I advise carefully reading the ldap_initialize(3) man page for how to correctly use the function.
https://bugs.openldap.org/show_bug.cgi?id=9299
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |VERIFIED
https://bugs.openldap.org/show_bug.cgi?id=9299
--- Comment #2 from Ritu Ritu.Varkey@microfocus.com --- Created attachment 751 --> https://bugs.openldap.org/attachment.cgi?id=751&action=edit Leaks after call to ldap_simple_bind
image of he leak captured using visual studio debug diagnostic tool
https://bugs.openldap.org/show_bug.cgi?id=9299
Ritu Ritu.Varkey@microfocus.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|INVALID |--- Status|VERIFIED |UNCONFIRMED
--- Comment #3 from Ritu Ritu.Varkey@microfocus.com --- Hi Quanah Gibson-Mount,
Thank You for you input,
I tried the code without ldap_open as per your suggestion.
But seems like the leak still persists.
I have attached the image of the leak.
Changing the status of the bug to unconfirmed.
https://bugs.openldap.org/show_bug.cgi?id=9299
--- Comment #4 from Quanah Gibson-Mount quanah@openldap.org --- Hello,
The code provided does not leak when adapted for Linux.
Additionally, your screenshot does not show the bottom of the stack trace, so lacks much of the necessary information. It would appear from what's been provided that the leak itself is originating in the TLS code rather than OpenLDAP, but without the full trace that can't be definitively determined.
https://bugs.openldap.org/show_bug.cgi?id=9299
--- Comment #5 from Ritu Ritu.Varkey@microfocus.com --- Created attachment 752 --> https://bugs.openldap.org/attachment.cgi?id=752&action=edit stack trace
Attaching part of the stack trace missing from the previous screenshot
https://bugs.openldap.org/show_bug.cgi?id=9299
--- Comment #6 from Howard Chu hyc@openldap.org --- (In reply to Ritu from comment #5)
Created attachment 752 [details] stack trace
Attaching part of the stack trace missing from the previous screenshot
The trace is unfortunately not detailed enough. The leak you're seeing is coming from unidentified code, labeled "[External Frame]" in your screenshot. In particular, it is not in libldap. Since it's in the part of libldap that wraps the OpenSSL API, the leak bug appears to be in your build of OpenSSL. But without full symbol info for that part of the trace, we can't identify exactly which function is the culprit. Regardless, this is not an OpenLDAP bug.
https://bugs.openldap.org/show_bug.cgi?id=9299
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED
https://bugs.openldap.org/show_bug.cgi?id=9299
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |VERIFIED