summaryrefslogtreecommitdiffstats
path: root/stringbuf.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2005-02-22 16:24:49 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2005-02-22 16:24:49 +0000
commit7ac6b3d6d0c387738a388790ba7b51b3dcf176fc (patch)
tree054e0442481800503c2633854c1b6d51b278901d /stringbuf.c
parent1d9fd143b71847c2bb17d0fc3989fdd59c68dddd (diff)
downloadrsyslog-7ac6b3d6d0c387738a388790ba7b51b3dcf176fc.tar.gz
rsyslog-7ac6b3d6d0c387738a388790ba7b51b3dcf176fc.tar.xz
rsyslog-7ac6b3d6d0c387738a388790ba7b51b3dcf176fc.zip
memory leak fixed
Diffstat (limited to 'stringbuf.c')
-rwxr-xr-xstringbuf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/stringbuf.c b/stringbuf.c
index d52c4455..b9a7721d 100755
--- a/stringbuf.c
+++ b/stringbuf.c
@@ -79,8 +79,9 @@ void sbStrBDestruct(sbStrBObj *pThis)
/* in this mode, a new buffer already was allocated,
* so we need to free the old one.
*/
- if(pThis->pBuf != NULL)
+ if(pThis->pBuf != NULL) {
free(pThis->pBuf);
+ }
# endif
SRFREEOBJ(pThis);
@@ -128,8 +129,9 @@ srRetVal sbStrBAppendChar(sbStrBObj *pThis, char c)
return SR_RET_OUT_OF_MEMORY;
memcpy(pNewBuf, pThis->pBuf, pThis->iBufSize);
pThis->iBufSize += pThis->iAllocIncrement;
- if(pThis->pBuf != NULL)
+ if(pThis->pBuf != NULL) {
free(pThis->pBuf);
+ }
pThis->pBuf = pNewBuf;
}