summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-12-17 07:01:30 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-12-17 07:01:30 +0000
commita34ed607d8aa1a537e031ef342674c32bf0d6e88 (patch)
tree0a556f23cfcbcb61b148a8b1d6878f9baed49b30
parent3f8f9f142c7bcc9c5dd97708b0611024037f2835 (diff)
downloadrsyslog-a34ed607d8aa1a537e031ef342674c32bf0d6e88.tar.gz
rsyslog-a34ed607d8aa1a537e031ef342674c32bf0d6e88.tar.xz
rsyslog-a34ed607d8aa1a537e031ef342674c32bf0d6e88.zip
fixed a potential race condition with enqueueMsg() - thanks to mildew for
making me aware of this issue
-rw-r--r--syslogd.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/syslogd.c b/syslogd.c
index e9e822eb..d0040422 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -2212,13 +2212,6 @@ void printline(char *hname, char *msg, int bParseHost)
logmsg(pri, pMsg, SYNC_FILE);
- /* rgerhards 2004-11-11:
- * we are done with the message object. If it still is
- * stored somewhere, we can call discard anyhow. This
- * is handled via the reference count - see description
- * of msg_t for details.
- */
- MsgDestruct(pMsg);
return;
}
@@ -2272,7 +2265,6 @@ logmsgInternal(int pri, char *msg, int flags)
* message to the queue engine.
*/
logmsg(pri, pMsg, flags);
- MsgDestruct(pMsg);
}
#else
iminternalAddMsg(pri, pMsg, flags);
@@ -2816,7 +2808,7 @@ static void enqueueMsg(msg_t *pMsg)
goto unlock;
}
}
- queueAdd(fifo, MsgAddRef(pMsg));
+ queueAdd(fifo, pMsg);
unlock:
/* now activate the worker thread */
pthread_mutex_unlock(fifo->mut);
@@ -5538,7 +5530,6 @@ static void processImInternal(void)
while(iminternalRemoveMsg(&iPri, &pMsg, &iFlags) == RS_RET_OK) {
logmsg(iPri, pMsg, iFlags);
- MsgDestruct(pMsg);
}
}