From c55bb999b214c2dbd7d27b37fb189d2514e7a169 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 17 Dec 2007 06:57:30 +0000 Subject: fixed a potential race condition with enqueueMsg() - thanks to mildew for making me aware of this issue --- syslogd.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'syslogd.c') 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); } } -- cgit v1.2.3