39648c7 Ticket #47455 - valgrind - value mem leaks, uninit mem usage

Authored and Committed by rmeggins 10 years ago
    Ticket #47455 - valgrind - value mem leaks, uninit mem usage
    
    https://fedorahosted.org/389/ticket/47455
    Reviewed by: lkrispenz, nhosoi (Thanks!)
    Branch: master
    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[0] 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
    (cherry picked from commit 5633e125a462fa174186d1a8adba3ee00c43e3cd)
    
        
file modified
+3 -0
file modified
+6 -3
file modified
+21 -2