summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-12-17 06:57:30 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-12-17 06:57:30 +0000
commitc55bb999b214c2dbd7d27b37fb189d2514e7a169 (patch)
treef2855f7a9ff153f5fa2bce04144475f431b83f58
parente45bbf5c66b5cb08c91bdb99ba1acf5f215c3112 (diff)
downloadrsyslog-c55bb999b214c2dbd7d27b37fb189d2514e7a169.tar.gz
rsyslog-c55bb999b214c2dbd7d27b37fb189d2514e7a169.tar.xz
rsyslog-c55bb999b214c2dbd7d27b37fb189d2514e7a169.zip
fixed a potential race condition with enqueueMsg() - thanks to mildew for
making me aware of this issue
-rw-r--r--syslogd.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/syslogd.c b/syslogd.c
index 53874f46..d762cf3b 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -2209,13 +2209,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;
}
@@ -2233,8 +2226,6 @@ logmsgInternal(int pri, char *msg, int flags)
{
msg_t *pMsg;
-dbgprintf("logmsgInternal: msg passed: '%s'\n", msg);
-
if((pMsg = MsgConstruct()) == NULL){
/* rgerhards 2004-11-09: calling panic might not be the
* brightest idea - however, it is the best I currently have
@@ -2270,7 +2261,6 @@ dbgprintf("logmsgInternal: msg passed: '%s'\n", msg);
* message to the queue engine.
*/
logmsg(pri, pMsg, flags);
- MsgDestruct(pMsg);
}
}
@@ -2718,7 +2708,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);
@@ -5474,7 +5464,6 @@ static void processImInternal(void)
while(iminternalRemoveMsg(&iPri, &pMsg, &iFlags) == RS_RET_OK) {
logmsg(iPri, pMsg, iFlags);
- MsgDestruct(pMsg);
}
}