Friday, March 27, 2020

[389-commits] [389-ds-base] branch 389-ds-base-1.4.1 updated: Issue 50984 - Memory leaks in disk monitoring

This is an automated email from the git hooks/post-receive script.

spichugi pushed a commit to branch 389-ds-base-1.4.1
in repository 389-ds-base.

The following commit(s) were added to refs/heads/389-ds-base-1.4.1 by this push:
new 324b5b1 Issue 50984 - Memory leaks in disk monitoring
324b5b1 is described below

commit 324b5b1d07cda032a64f87ad98d505d427c43f10
Author: Simon Pichugin <spichugi@redhat.com>
AuthorDate: Thu Mar 26 19:33:47 2020 +0100

Issue 50984 - Memory leaks in disk monitoring

Description: Memory leaks are reported by the disk monitoring test suite.
The direct leak is related to char **dirs array which is not freed at all.
Free the array when we clean up or go to shutdown.

https://pagure.io/389-ds-base/issue/50984

Reviewed by: firstyear, tbordaz (Thanks!)
---
ldap/servers/slapd/daemon.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index 345e292..446f91e 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -501,8 +501,7 @@ disk_monitoring_thread(void *nothing __attribute__((unused)))
slapi_log_err(SLAPI_LOG_ALERT, "disk_monitoring_thread",
"Disk space is critically low on disk (%s), remaining space: %" PRIu64 " Kb. Signaling slapd for shutdown...\n",
dirstr, (disk_space / 1024));
- g_set_shutdown(SLAPI_SHUTDOWN_DISKFULL);
- return;
+ goto cleanup;
}
/*
* If we are low, see if we are using verbose error logging, and turn it off
@@ -570,6 +569,8 @@ disk_monitoring_thread(void *nothing __attribute__((unused)))
now = start;
while ((now - start) < grace_period) {
if (g_get_shutdown()) {
+ slapi_ch_array_free(dirs);
+ dirs = NULL;
return;
}
/*
@@ -612,8 +613,7 @@ disk_monitoring_thread(void *nothing __attribute__((unused)))
slapi_log_err(SLAPI_LOG_ALERT, "disk_monitoring_thread",
"Disk space is critically low on disk (%s), remaining space: %" PRIu64 " Kb. Signaling slapd for shutdown...\n",
dirstr, (disk_space / 1024));
- g_set_shutdown(SLAPI_SHUTDOWN_DISKFULL);
- return;
+ goto cleanup;
}
now = slapi_current_utc_time();
}
@@ -630,11 +630,14 @@ disk_monitoring_thread(void *nothing __attribute__((unused)))
slapi_log_err(SLAPI_LOG_ALERT, "disk_monitoring_thread",
"Disk space is still too low (%" PRIu64 " Kb). Signaling slapd for shutdown...\n",
(disk_space / 1024));
- g_set_shutdown(SLAPI_SHUTDOWN_DISKFULL);
-
- return;
+ goto cleanup;
}
}
+ cleanup:
+ slapi_ch_array_free(dirs);
+ dirs = NULL;
+ g_set_shutdown(SLAPI_SHUTDOWN_DISKFULL);
+ return;
}

static void

--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
389-commits mailing list -- 389-commits@lists.fedoraproject.org
To unsubscribe send an email to 389-commits-leave@lists.fedoraproject.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/389-commits@lists.fedoraproject.org

No comments:

Post a Comment