summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-24 09:51:55 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-24 09:51:55 +0000
commitf1e14aefde8c295a2cbd93b9118d32961b6c373f (patch)
tree54d240a5253bb530b2b93c8752bce43d74d1c8db
parentf97c90d12b9ae64a64cde84bb3fa3ca5ee207838 (diff)
downloadrsyslog-f1e14aefde8c295a2cbd93b9118d32961b6c373f.tar.gz
rsyslog-f1e14aefde8c295a2cbd93b9118d32961b6c373f.tar.xz
rsyslog-f1e14aefde8c295a2cbd93b9118d32961b6c373f.zip
applied patch from varmojfekoj to solve small mem leak
-rw-r--r--ChangeLog2
-rw-r--r--syslogd.c20
2 files changed, 21 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 6a4abc3f..3fd61b3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
---------------------------------------------------------------------------
Version 1.17.3 (rgerhards), 2007-07-2?
- continued working on modularization
-- fixed a memory leak in config file parsing
+- fixed a memory leak in config file parsing and die()
thanks to varmojfekoj <varmojfekoj@gmail.com> for the patch
- rsyslogd now checks on startup if it is capable to performa any work
at all. If it cant, it complains and terminates
diff --git a/syslogd.c b/syslogd.c
index 6b8bd148..0c3b117c 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -3529,6 +3529,19 @@ static void die(int sig)
if (f->f_type == F_MYSQL)
closeMySQL(f);
#endif
+ switch (f->f_type) {
+ case F_FORW:
+ case F_FORW_SUSP:
+ freeaddrinfo(f->f_un.f_forw.f_addr);
+ /* fall through */
+ case F_FORW_UNKN:
+ if (f->f_un.f_forw.port != NULL)
+ free(f->f_un.f_forw.port);
+ }
+
+ if (f->f_psziov != NULL)
+ free(f->f_psziov);
+
fPrev = f;
f = f->f_next;
free(fPrev);
@@ -4219,6 +4232,10 @@ static void init()
free(f->f_iov);
}
+ /* free iov string */
+ if (f->f_psziov != NULL)
+ free(f->f_psziov);
+
switch (f->f_type) {
case F_FILE:
case F_PIPE:
@@ -4227,7 +4244,10 @@ static void init()
freeInstanceFile(f);
break;
case F_FORW:
+ case F_FORW_SUSP:
freeaddrinfo(f->f_un.f_forw.f_addr);
+ /* fall through */
+ case F_FORW_UNKN:
if(f->f_un.f_forw.port != NULL)
free(f->f_un.f_forw.port);
break;