https://bugs.openldap.org/show_bug.cgi?id=10545
Issue ID: 10545 Summary: urltest leaks the parsed LDAPURLDesc and reconstructed URL string 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/urltest.c
Affected lines: 75 and 125-127
Source-level observation:
On a successful call, ldap_url_parse() allocates an LDAPURLDesc and stores it in lud. The program reaches its final return without calling ldap_free_urldesc(lud).
There is also a second allocation on line 125:
fprintf(stdout, "URL: %s\n", ldap_url_desc2str(lud));
ldap_url_desc2str() allocates its returned string with LDAP_MALLOC. Because the return value is passed directly to fprintf(), its pointer is lost and the string cannot be released.
Steps to verify:
1. Build libraries/libldap/urltest with AddressSanitizer or LeakSanitizer. 2. Run it with a valid URL, for example: ./urltest 'ldap://localhost/dc=example,dc=com??sub?(objectClass=*)' 3. Allow the program to exit successfully. 4. Inspect the sanitizer report.
Actual result:
A successful invocation exits without releasing either the LDAPURLDesc or the string returned by ldap_url_desc2str().
Expected result:
Both allocations should be released before returning from main().
Impact:
Each successful run leaves two process-lifetime allocations. The practical impact is low because urltest is a short-lived test utility, but the ownership contracts are not followed and leak detectors report the allocations.
Validation status:
Confirmed by source review at the revision above. Runtime sanitizer validation is pending.
https://bugs.openldap.org/show_bug.cgi?id=10545
--- Comment #1 from Howard Chu hyc@openldap.org --- Nobody cares about one-shot test programs.
https://bugs.openldap.org/show_bug.cgi?id=10545
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Assignee|bugs@openldap.org |hyc@openldap.org Keywords|needs_review | Target Milestone|--- |2.7.0
https://bugs.openldap.org/show_bug.cgi?id=10545
Howard Chu hyc@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |TEST
--- Comment #2 from Howard Chu hyc@openldap.org --- Fixed in 60d2430131acab388486f0bb3de64a1bb9c89048 to shut up braindead AI
https://bugs.openldap.org/show_bug.cgi?id=10545
--- Comment #3 from Quanah Gibson-Mount quanah@openldap.org --- head:
• 60d24301 by Howard Chu at 2026-07-21T16:54:31+01:00 ITS#10545 urltest: silence braindead AI complaints
RE27:
• f76fd4f1 by Howard Chu at 2026-07-21T17:34:06+00:00 ITS#10545 urltest: silence braindead AI complaints
https://bugs.openldap.org/show_bug.cgi?id=10545
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|TEST |FIXED Status|RESOLVED |VERIFIED