summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-03-01 16:00:22 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2011-03-01 16:00:22 +0100
commitc130eb20215d5f4ed4fc23c4bf0223b77176617b (patch)
treecf00632ac5c70f2e4aa70be76938127e4fa5d054 /plugins
parent74a71e798efd58e20cc150b04de2613bf518eed4 (diff)
downloadrsyslog-c130eb20215d5f4ed4fc23c4bf0223b77176617b.tar.gz
rsyslog-c130eb20215d5f4ed4fc23c4bf0223b77176617b.tar.xz
rsyslog-c130eb20215d5f4ed4fc23c4bf0223b77176617b.zip
improved testbench
- added valgrind-based test (the first one ever ;)) - fixed memory leak in imdiag (guess how this was detected...)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/imdiag/imdiag.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/imdiag/imdiag.c b/plugins/imdiag/imdiag.c
index f96bf754..36fe7e50 100644
--- a/plugins/imdiag/imdiag.c
+++ b/plugins/imdiag/imdiag.c
@@ -291,6 +291,7 @@ OnMsgReceived(tcps_sess_t *pSess, uchar *pRcv, int iLenMsg)
{
int iMsgQueueSize;
uchar *pszMsg;
+ uchar *pToFree = NULL;
uchar cmdBuf[1024];
DEFiRet;
@@ -302,6 +303,7 @@ OnMsgReceived(tcps_sess_t *pSess, uchar *pRcv, int iLenMsg)
* before proceeding.
*/
CHKmalloc(pszMsg = MALLOC(sizeof(uchar) * (iLenMsg + 1)));
+ pToFree = pszMsg;
memcpy(pszMsg, pRcv, iLenMsg);
pszMsg[iLenMsg] = '\0';
@@ -321,6 +323,8 @@ OnMsgReceived(tcps_sess_t *pSess, uchar *pRcv, int iLenMsg)
}
finalize_it:
+ if(pToFree != NULL)
+ free(pToFree);
RETiRet;
}