https://bugs.openldap.org/show_bug.cgi?id=10546
Issue ID: 10546 Summary: ldap_explode_dn result is not released in the interactive test client Product: OpenLDAP Version: unspecified Hardware: All OS: All Status: UNCONFIRMED Keywords: needs_review Severity: normal Priority: --- Component: libraries Assignee: bugs@openldap.org Reporter: 1489378385@qq.com Target Milestone: ---
URL: https://github.com/openldap/openldap/blob/8afcbe9e04f1a40f03cea51c57418b05f8...
Description:
Source revision: 8afcbe9e04f1a40f03cea51c57418b05f86e8f44
Affected file: libraries/libldap/test.c
Affected lines: 472-478
Source-level observation:
The interactive test client's E command calls ldap_explode_dn() and stores the returned NULL-terminated array in exdn. It prints the array elements and then leaves the switch case without releasing exdn.
According to ldap_get_dn(3), the result returned by ldap_explode_dn() should be released with ldap_value_free().
The only reference to the allocated array is overwritten the next time the E command is executed.
Steps to verify:
1. Build the libraries/libldap interactive test client with AddressSanitizer or LeakSanitizer enabled. 2. Start the test client. 3. Execute the E command and enter a valid DN, for example: cn=test,dc=example,dc=com 4. Repeat the E command several times. 5. Exit the client and inspect the sanitizer report or monitor its memory use.
Actual result:
Each E command allocates an exploded DN array that remains allocated until the process terminates.
Expected result:
The exploded DN array should be released after all of its elements have been printed.
Impact:
Repeated use of the E command increases the test client's memory consumption.
Validation status:
Confirmed by source review at the revision above. Runtime sanitizer validation is pending.