Open dafanasiev opened 8 months ago
Are you sure about this memory leak?
It isn't exactly straight forward, but I think the LDAP structure will be freed eventually during the deallocation of the LDAPConnection here with the ldap_unbind_ext
function.
Hmm... I prefer to clean up the resources where the error occurred. Because there is no way to restore the ldpa connection state.
In ldap-xplat.c#L714 you allocate
LDAP
.before
ldap_initialize
call just nullLDAP*
:ldap_set_option
also calls can return other thanLDAP_SUCCESS
result, so we need to control this (for example):and finally at the
end
label we need to freeLDAP
struct if we have problems (and allocate it):