https://bugzilla.redhat.com/show_bug.cgi?id=440474
Resolves: bug 440474
Bug Description: A number of memory leaks in the memberOf plug-in occur
during
various operations on member attributes. These leaks were discovered
using
valgrind to run ns-slapd.
Reviewed by: ???
Files: see diff
Branch: HEAD
Fix Description: We were allocating a Slapi_Mods in the modify callback
and never
calling slapi_mods_free() would cause a double free. This is because
we are
initialing the Slapi_Mods by passing in the LDAPMod array from
SLAPI_MODIFY_MODS
in the pblock. This will make slapi_mods_free() do a free of the
LDAPMod elements,
but do_modify() is responsible for freeing the LDAPMod array in the
pblock. The
solution is to initialize the Slapi_Mods by reference so
slapi_mods_free() doesn't
try to free the LDAPMod array.
There were 4 places where we were allocating a Slapi_Entry by calling
slapi_search_internal_get_entry(), but never freeing the entry when we
were
finished with it.
We were allocating two Slapi_Value arrays with slapi_ch_malloc(), but were
never calling slapi_ch_free() when we were finished.
Platforms tested: RHEL5.1 x86_64
Flag Day: No.
Doc impact: None.
https://bugzilla.redhat.com/attachment.cgi?id=300297&action=diff