summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-04-09 12:26:56 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-04-09 12:26:56 +0200
commita08ac7546fb3ff97e7cb7a8d5212eba159c112ec (patch)
treec624ee04164e59f1419de91bf2da6361858a836a
parent3c236053cf87a16dfd7449f729e477dffd6e2fae (diff)
downloadrsyslog-a08ac7546fb3ff97e7cb7a8d5212eba159c112ec.tar.gz
rsyslog-a08ac7546fb3ff97e7cb7a8d5212eba159c112ec.tar.xz
rsyslog-a08ac7546fb3ff97e7cb7a8d5212eba159c112ec.zip
bugfix: potential memory leak in msg.c
This one did not surface yet and the issue was actually found due to a problem in v4 - but better fix it here, too.
-rw-r--r--ChangeLog3
-rw-r--r--msg.c2
2 files changed, 5 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 8d7b5b40..6e36531d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,9 @@ Version 2.0.7 V2-STABLE (rgerhards), 2008-??-??
The actual code change is heavily based on William's patch.
- bugfix: memory leak in ompgsql
Thanks to Ken for providing the patch
+- bugfix: potential memory leak in msg.c
+ This one did not surface yet and the issue was actually found due to
+ a problem in v4 - but better fix it here, too
---------------------------------------------------------------------------
Version 2.0.6 V2-STABLE (rgerhards), 2008-08-07
- bugfix: memory leaks in rsyslogd, primarily in singlethread mode
diff --git a/msg.c b/msg.c
index 3473495c..9ac45c57 100644
--- a/msg.c
+++ b/msg.c
@@ -1116,6 +1116,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;
}