summaryrefslogtreecommitdiffstats
path: root/runtime/queue.c
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 /runtime/queue.c
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
Diffstat (limited to 'runtime/queue.c')
-rw-r--r--runtime/queue.c15
1 files changed, 5 insertions, 10 deletions
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);