[collectd] [PATCH] exec plugin: Fixed a possible (though very improbable) memory leak.
Sebastian Harl
sh at tokkee.org
Sun Jan 27 23:26:41 CET 2008
In case of an error, the program_list_and_notification_t pointer has not been
freed before calling pthread_exit() from exec_notification_one().
Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
src/exec.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/exec.c b/src/exec.c
index e7648bd..d5a8d0f 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -581,8 +581,10 @@ static void *exec_notification_one (void *arg) /* {{{ */
const char *severity;
pid = fork_child (pl, &fd, NULL);
- if (pid < 0)
+ if (pid < 0) {
+ sfree (arg);
pthread_exit ((void *) 1);
+ }
fh = fdopen (fd, "w");
if (fh == NULL)
@@ -593,6 +595,7 @@ static void *exec_notification_one (void *arg) /* {{{ */
kill (pl->pid, SIGTERM);
pl->pid = 0;
close (fd);
+ sfree (arg);
pthread_exit ((void *) 1);
}
--
1.5.4.rc4.23.gcab31
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20080127/d88b90fd/attachment.pgp
More information about the collectd
mailing list