From 7ac6b3d6d0c387738a388790ba7b51b3dcf176fc Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 22 Feb 2005 16:24:49 +0000 Subject: memory leak fixed --- stringbuf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'stringbuf.c') 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; } -- cgit