Blame SOURCES/0012-Issue-50984-Memory-leaks-in-disk-monitoring.patch

d69b2b
From 2540354b7eb6fa03db7d36a5b755001b0852aa1b Mon Sep 17 00:00:00 2001
d69b2b
From: Simon Pichugin <spichugi@redhat.com>
d69b2b
Date: Thu, 26 Mar 2020 19:33:47 +0100
d69b2b
Subject: [PATCH] Issue 50984 - Memory leaks in disk monitoring
d69b2b
d69b2b
Description: Memory leaks are reported by the disk monitoring test suite.
d69b2b
The direct leak is related to char **dirs array which is not freed at all.
d69b2b
Free the array when we clean up or go to shutdown.
d69b2b
Fix disk_monitoring_test.py::test_below_half_of_the_threshold_not_starting_after_shutdown.
d69b2b
It should accept different exception when the instance is not started.
d69b2b
d69b2b
https://pagure.io/389-ds-base/issue/50984
d69b2b
d69b2b
Reviewed by: firstyear (Thanks!)
d69b2b
---
d69b2b
 ldap/servers/slapd/daemon.c | 2 --
d69b2b
 ldap/servers/slapd/main.c   | 1 -
d69b2b
 2 files changed, 3 deletions(-)
d69b2b
d69b2b
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
d69b2b
index a70f40316..542d31037 100644
d69b2b
--- a/ldap/servers/slapd/daemon.c
d69b2b
+++ b/ldap/servers/slapd/daemon.c
d69b2b
@@ -613,7 +613,6 @@ disk_monitoring_thread(void *nothing __attribute__((unused)))
d69b2b
                         }
d69b2b
                     }
d69b2b
                     slapi_ch_array_free(dirs);
d69b2b
-                    dirs = NULL;
d69b2b
                     return;
d69b2b
                 }
d69b2b
                 /*
d69b2b
@@ -713,7 +712,6 @@ disk_monitoring_thread(void *nothing __attribute__((unused)))
d69b2b
             }
d69b2b
         }
d69b2b
         slapi_ch_array_free(dirs);
d69b2b
-        dirs = NULL; /* now it is not needed but the code may be changed in the future and it'd better be more robust */
d69b2b
         g_set_shutdown(SLAPI_SHUTDOWN_DISKFULL);
d69b2b
         return;
d69b2b
 }
d69b2b
diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c
d69b2b
index e54b8e1c5..1f8b01959 100644
d69b2b
--- a/ldap/servers/slapd/main.c
d69b2b
+++ b/ldap/servers/slapd/main.c
d69b2b
@@ -958,7 +958,6 @@ main(int argc, char **argv)
d69b2b
             goto cleanup;
d69b2b
         }
d69b2b
         slapi_ch_array_free(dirs);
d69b2b
-        dirs = NULL;
d69b2b
     }
d69b2b
     /* log the max fd limit as it is typically set in env/systemd */
d69b2b
     slapi_log_err(SLAPI_LOG_INFO, "main",
d69b2b
-- 
d69b2b
2.26.2
d69b2b