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

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