diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-04-08 18:59:15 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-04-08 18:59:15 +0200 |
commit | 1cfa08749b1c474de850f693915b9a32d456c593 (patch) | |
tree | e360cdddb66faecef8ec9e600025570728f6d1bd /runtime | |
parent | 51e690f720b4a53a431e7a536b2fe8c25e866f7d (diff) | |
download | rsyslog-1cfa08749b1c474de850f693915b9a32d456c593.tar.gz rsyslog-1cfa08749b1c474de850f693915b9a32d456c593.tar.xz rsyslog-1cfa08749b1c474de850f693915b9a32d456c593.zip |
bugfix: solved potential memory leak in msg processing
could manifest itself in imtcp (loss of a few bytes for *each* received
message - but depended on config) -- this was newly introduced
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/msg.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index 5d1f21fd..9d5f3838 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -1542,6 +1542,8 @@ void MsgAssignHOSTNAME(msg_t *pMsg, char *pBuf) { assert(pMsg != NULL); assert(pBuf != NULL); + if(pMsg->pszHOSTNAME != NULL) + free(pMsg->pszHOSTNAME); pMsg->iLenHOSTNAME = strlen(pBuf); pMsg->pszHOSTNAME = (uchar*) pBuf; } @@ -1567,7 +1569,7 @@ void MsgSetHOSTNAME(msg_t *pMsg, char* pszHOSTNAME) if((pMsg->pszHOSTNAME = malloc(pMsg->iLenHOSTNAME + 1)) != NULL) memcpy(pMsg->pszHOSTNAME, pszHOSTNAME, pMsg->iLenHOSTNAME + 1); else - dbgprintf("Could not allocate memory in MsgSetHOSTNAME()\n"); + DBGPRINTF("Could not allocate memory in MsgSetHOSTNAME()\n"); } |