summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-04-23 14:29:41 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-04-23 14:29:41 +0200
commit6c5264159c099ddc4d06590508980ee53a83b67b (patch)
treeec209c9bdd5d735bc36d504a8c5025d00e1b2b46
parent31ba42de664341c0c25236c619c7e1eb81f71d1d (diff)
downloadrsyslog-6c5264159c099ddc4d06590508980ee53a83b67b.tar.gz
rsyslog-6c5264159c099ddc4d06590508980ee53a83b67b.tar.xz
rsyslog-6c5264159c099ddc4d06590508980ee53a83b67b.zip
fixing a small (newly-introduced) memory leak
... plus simplifying free() calls after agreement on mailing list that we no longer need to check if the pointer is non-NULL
-rw-r--r--plugins/imtcp/imtcp.c12
-rw-r--r--runtime/queue.c15
-rw-r--r--runtime/wti.c8
-rw-r--r--runtime/wtp.c3
4 files changed, 13 insertions, 25 deletions
diff --git a/plugins/imtcp/imtcp.c b/plugins/imtcp/imtcp.c
index 5a8a62f6..9883fa89 100644
--- a/plugins/imtcp/imtcp.c
+++ b/plugins/imtcp/imtcp.c
@@ -245,14 +245,10 @@ resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unus
iTCPSessMax = 200;
iStrmDrvrMode = 0;
iAddtlFrameDelim = TCPSRV_NO_ADDTL_DELIMITER;
- if(pszInputName != NULL) {
- free(pszInputName);
- pszInputName = NULL;
- }
- if(pszStrmDrvrAuthMode != NULL) {
- free(pszStrmDrvrAuthMode);
- pszStrmDrvrAuthMode = NULL;
- }
+ free(pszInputName);
+ pszInputName = NULL;
+ free(pszStrmDrvrAuthMode);
+ pszStrmDrvrAuthMode = NULL;
return RS_RET_OK;
}
diff --git a/runtime/queue.c b/runtime/queue.c
index f3d3fe71..a5feef3d 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -490,9 +490,7 @@ static rsRetVal qDestructFixedArray(qqueue_t *pThis)
ASSERT(pThis != NULL);
queueDrain(pThis); /* discard any remaining queue entries */
-
- if(pThis->tVars.farray.pBuf != NULL)
- free(pThis->tVars.farray.pBuf);
+ free(pThis->tVars.farray.pBuf);
RETiRet;
}
@@ -2063,11 +2061,8 @@ CODESTARTobjDestruct(qqueue)
/* type-specific destructor */
iRet = pThis->qDestruct(pThis);
- if(pThis->pszFilePrefix != NULL)
- free(pThis->pszFilePrefix);
-
- if(pThis->pszSpoolDir != NULL)
- free(pThis->pszSpoolDir);
+ free(pThis->pszFilePrefix);
+ free(pThis->pszSpoolDir);
ENDobjDestruct(qqueue)
@@ -2081,8 +2076,8 @@ qqueueSetFilePrefix(qqueue_t *pThis, uchar *pszPrefix, size_t iLenPrefix)
{
DEFiRet;
- if(pThis->pszFilePrefix != NULL)
- free(pThis->pszFilePrefix);
+ free(pThis->pszFilePrefix);
+ pThis->pszFilePrefix = NULL;
if(pszPrefix == NULL) /* just unset the prefix! */
ABORT_FINALIZE(RS_RET_OK);
diff --git a/runtime/wti.c b/runtime/wti.c
index df1ea0ed..32eab57c 100644
--- a/runtime/wti.c
+++ b/runtime/wti.c
@@ -201,11 +201,9 @@ CODESTARTobjDestruct(wti)
pthread_cond_destroy(&pThis->condExitDone);
pthread_mutex_destroy(&pThis->mut);
- if(pThis->paUsrp != NULL)
- free(pThis->paUsrp);
-
- if(pThis->pszDbgHdr != NULL)
- free(pThis->pszDbgHdr);
+ free(pThis->paUsrp->pUsrp);
+ free(pThis->paUsrp);
+ free(pThis->pszDbgHdr);
ENDobjDestruct(wti)
diff --git a/runtime/wtp.c b/runtime/wtp.c
index 8bb55cf7..a23e85f9 100644
--- a/runtime/wtp.c
+++ b/runtime/wtp.c
@@ -152,8 +152,7 @@ CODESTARTobjDestruct(wtp)
pthread_mutex_destroy(&pThis->mut);
pthread_mutex_destroy(&pThis->mutThrdShutdwn);
- if(pThis->pszDbgHdr != NULL)
- free(pThis->pszDbgHdr);
+ free(pThis->pszDbgHdr);
ENDobjDestruct(wtp)