Pourya Adeli via Postfix-users:
> Hi all,
>
> While profiling LDAP lookup performance using Valgrind, I identified a
> minor memory leak in `dict_ldap_vendor_version()` inside
> `src/global/dict_ldap.c`.
>
> When `dict_ldap_vendor_version()` queries LDAP API info via
> `ldap_get_option(..., LDAP_OPT_API_INFO, &api)`, the OpenLDAP C API
> internally allocates memory for `api.ldapai_vendor_name` and
> `api.ldapai_extensions`. Currently, the function directly returns
> `api.ldapai_vendor_version` without freeing these allocated pointers.
>
> This is explicitly documented in the ldap_get_option(3) manual page:
> "The caller is responsible for freeing the elements of the
> ldapai_extensions array and the array itself using ldap_memfree(3). The
> caller must also free the ldapi_vendor_name."
You're freeing api.ldapai_vendor_name and api.ldapai_extensions
without checking if they are NULL. Is that OK?
Otherwise, the patch looks good.
The patch uses ldap_memvfree() which appears to be appropriate.
Fortunately, this function has been around for a decade+ so no
worries that this patch would break working systems.
This is a one-time leak, usually during program initialization,
so it has no real impact.
Wietse
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]