#50827 Issue 50599 - Fix memory leak when removing db region files
Closed 3 years ago by spichugi. Opened 4 years ago by mreynolds.
mreynolds/389-ds-base issue50599  into  master

@@ -1072,7 +1072,7 @@ 

  

                  /* Better wipe out the region files to help ensure a clean start */

                  PR_snprintf(file_pattern, MAXPATHLEN, "%s/%s", region_dir, "__db.*");

-                 if (glob(file_pattern, GLOB_DOOFFS, NULL, &globbuf) == 0) {

+                 if (glob(file_pattern, 0, NULL, &globbuf) == 0) {

It looks good to me. ACK

Note : We can possibly use flag GLOB_NOSORT that will save processing.

                      for (size_t i = 0; i < globbuf.gl_pathc; i++) {

                          remove(globbuf.gl_pathv[i]);

                      }

Description:

An unnecessary flag was set in glob() that was resulting in a memory leak in the DS code. Removing this flag eliminated the leak.

Passed ASAN tests

relates: https://pagure.io/389-ds-base/issue/50599

It looks good to me. ACK

Note : We can possibly use flag GLOB_NOSORT that will save processing.

It looks good to me. ACK
Note : We can possibly use flag GLOB_NOSORT that will save processing.

We can look into that, but sorting a few files probably doesn't take long and during database recovery performance is not really a big concern (especially the few milliseconds we might save with this flag).

rebased onto cf849cc

4 years ago

Pull-Request has been merged by mreynolds

4 years ago

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/3881

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

3 years ago
Metadata