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

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