Ticket #47455 - valgrind - value mem leaks, uninit mem usage
Reviewed by: lkrispenz, nhosoi (Thanks!)
Fix Description: Make sure to use slapi_valueset_done to free valuesets to
clean up everything. Make sure to free the values in valueset_set_valueset
before setting them. The calculation of the size of the values to write
to the changelog was wrong. It was finding the size of the length by doing
sizeof(bv.bv_len) which is 8 bytes on 64-bit platforms, but using PRInt32 which
is 4 bytes on all platforms to actually store the length. So each length
calculation was using an extra 4 bytes, and writing this as uninitialized
memory to the changelog db.
In slapi_valueset_add_attr_valuearray_ext(), if an error is returned, and
the PASSIN flag was used, set the vs->va to NULL - this will allow the
called to use both slapi_valueset_done(vs) and valuearray_free(&addvals) -
addvals will still own all of the values.
Cleaned up some other memory leaks and uninitialized memory uses.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no