#51021 Issue 51016 - Fix memory leaks in changelog5_init and perfctrs_init
Closed by spichugi. Opened by spichugi.
spichugi/389-ds-base i51016  into  master

Download 51021.patch

Bug Description: Memory Leaks are detected by ASAN in changelog5_init
and perfctrs_init functions.

Fix Description: Free existing memory before initializing new memory
which will be assigned to the existing stucts.

https://pagure.io/389-ds-base/issue/51016

Reviewed by: ?

rebased onto 7e61d4bacc99db4cf1c2e5ef34cbb6845fb33dd1

I don't like the call to cl5Cleanup in chanelog5_init. It might fix the leak, but doing the cleanup before the init is not the right place, it is normally used only at startup and the you do not need the cleanup.
Only in the archive case where changelog5_init is registered for SLAPI_PLUGIN_BE_POST_OPEN_FN it can cause problems, but this means that it was not properly cleaned when closed. You should ensur that the function registered for SLAPI_PLUGIN_BE_PRE_CLOSE_FN does the right thing, it should probably be changelog 5_cleanup instead of cl5Close

rebased onto b6571896505432fa98e23115367066a688c23124

Changes are made and tested for the leaks (it's clean). Please, review :)

@lkrispen did you suggest to call changelog5_cleanup or cl5Cleanup, during SLAPI_PLUGIN_BE_PRE_CLOSE_FN ?

cl5Cleanup also calls cl5Close, changelog5_cleanup calls both (and in addition some config cleanup, but looks like this doesn't leak). So I am fine with cl5Cleanup

rebased onto 46fb7cee43a396ed9f58b2d6a7495c6dba4948c4

Pull-Request has been merged by spichugi

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/4074

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

Metadata