summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-12-20 07:48:56 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-12-20 07:48:56 +0000
commit177eb0ec5d444537dd11c1dde3a20189d1e3ba71 (patch)
tree556d26c377f92a3bc9cf3ffb29051776f0db4f9b
parentbf1713a5d0b11d2200559b98a71431f1e0657d6d (diff)
downloadrsyslog-177eb0ec5d444537dd11c1dde3a20189d1e3ba71.tar.gz
rsyslog-177eb0ec5d444537dd11c1dde3a20189d1e3ba71.tar.xz
rsyslog-177eb0ec5d444537dd11c1dde3a20189d1e3ba71.zip
bugfix: fixing memory leak when message queue is full and during parsing.
Thanks to varmojfekoj for the patch.
-rw-r--r--ChangeLog2
-rw-r--r--syslogd.c10
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index b1a87f13..b5a69f9b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
Version 2.0.0 (rgerhards), 2007-12-??
- small doc fix for $IncludeConfig
- fixed a bug in llDestroy()
+- bugfix: fixing memory leak when message queue is full and during
+ parsing. Thanks to varmojfekoj for the patch.
---------------------------------------------------------------------------
Version 1.21.0 (rgerhards), 2007-12-19
- GSS-API support for syslog/TCP connections was added. Thanks to
diff --git a/syslogd.c b/syslogd.c
index 9285e727..963185c6 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -2824,6 +2824,7 @@ static void enqueueMsg(msg_t *pMsg)
if(pthread_cond_timedwait (fifo->notFull,
fifo->mut, &t) != 0) {
dbgprintf("enqueueMsg: cond timeout, dropping message!\n");
+ MsgDestruct(pMsg);
goto unlock;
}
}
@@ -3030,6 +3031,7 @@ static int parseRFCSyslogMsg(msg_t *pMsg, int flags)
/* MSG */
MsgSetMSG(pMsg, p2parse);
+ free(pBuf);
return 0; /* all ok */
}
/* parse a legay-formatted syslog message. This function returns
@@ -3249,13 +3251,17 @@ logmsg(int pri, msg_t *pMsg, int flags)
if(msg[0] == '1' && msg[1] == ' ') {
dbgprintf("Message has syslog-protocol format.\n");
setProtocolVersion(pMsg, 1);
- if(parseRFCSyslogMsg(pMsg, flags) == 1)
+ if(parseRFCSyslogMsg(pMsg, flags) == 1) {
+ MsgDestruct(pMsg);
return;
+ }
} else { /* we have legacy syslog */
dbgprintf("Message has legacy syslog format.\n");
setProtocolVersion(pMsg, 0);
- if(parseLegacySyslogMsg(pMsg, flags) == 1)
+ if(parseLegacySyslogMsg(pMsg, flags) == 1) {
+ MsgDestruct(pMsg);
return;
+ }
}
/* ---------------------- END PARSING ---------------- */