From 49bd12d05d940a4e4b129c29e56599a8098f2164 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 19 Jun 2015 10:54:02 +0200 Subject: [PATCH] collectdmon: Fix memory leak. --- src/collectdmon.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/collectdmon.c b/src/collectdmon.c index 078b2eb1..c81ca3f4 100644 --- a/src/collectdmon.c +++ b/src/collectdmon.c @@ -312,7 +312,10 @@ int main (int argc, char **argv) openlog ("collectdmon", LOG_CONS | LOG_PID, LOG_DAEMON); if (-1 == daemonize ()) + { + free (collectd_argv); return 1; + } sa.sa_handler = sig_int_term_handler; sa.sa_flags = 0; @@ -320,11 +323,13 @@ int main (int argc, char **argv) if (0 != sigaction (SIGINT, &sa, NULL)) { syslog (LOG_ERR, "Error: sigaction() failed: %s", strerror (errno)); + free (collectd_argv); return 1; } if (0 != sigaction (SIGTERM, &sa, NULL)) { syslog (LOG_ERR, "Error: sigaction() failed: %s", strerror (errno)); + free (collectd_argv); return 1; } @@ -332,6 +337,7 @@ int main (int argc, char **argv) if (0 != sigaction (SIGHUP, &sa, NULL)) { syslog (LOG_ERR, "Error: sigaction() failed: %s", strerror (errno)); + free (collectd_argv); return 1; } -- 2.30.2