From a171670d8706f201e18223d145f8685038cfbd6a Mon Sep 17 00:00:00 2001 From: Simon Pichugin Date: Mar 27 2020 10:37:01 +0000 Subject: Issue 50984 - Memory leaks in disk monitoring Description: Reset dirs pointer every time we free it. The code may be changed in the future so we should make it more robust. https://pagure.io/389-ds-base/issue/50984 Reviewed by: spichugi, tbordaz (one line commit rule) --- diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c index e7a5c28..65f2336 100644 --- a/ldap/servers/slapd/daemon.c +++ b/ldap/servers/slapd/daemon.c @@ -613,6 +613,7 @@ disk_monitoring_thread(void *nothing __attribute__((unused))) } } slapi_ch_array_free(dirs); + dirs = NULL; return; } /* @@ -712,6 +713,7 @@ disk_monitoring_thread(void *nothing __attribute__((unused))) } } slapi_ch_array_free(dirs); + dirs = NULL; /* now it is not needed but the code may be changed in the future and it'd better be more robust */ g_set_shutdown(SLAPI_SHUTDOWN_DISKFULL); return; } diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c index 7d7c9ac..5eafb91 100644 --- a/ldap/servers/slapd/main.c +++ b/ldap/servers/slapd/main.c @@ -958,6 +958,7 @@ main(int argc, char **argv) goto cleanup; } slapi_ch_array_free(dirs); + dirs = NULL; } /* log the max fd limit as it is typically set in env/systemd */ slapi_log_err(SLAPI_LOG_INFO, "main",