From e114e0d7e5c2df006fc89d8625274da099327e2e Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 11 Sep 2007 15:39:00 +0000 Subject: - removed compiler warnings in non-debug mode - fixed a bug that caused the CStr class to not honor the parameter to return NULL on empty string - causes a mem leak and can create favourable environment for other bugs (as it leads to empty hostnames) --- stringbuf.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'stringbuf.c') diff --git a/stringbuf.c b/stringbuf.c index ff5e9332..53535e4b 100755 --- a/stringbuf.c +++ b/stringbuf.c @@ -352,9 +352,13 @@ rsRetVal rsCStrConvSzStrAndDestruct(rsCStrObj *pThis, uchar **ppSz, int bRetNULL assert(bRetNULL == 0 || bRetNULL == 1); if(pThis->pBuf == NULL) { - if((pRetBuf = malloc(sizeof(uchar))) == NULL) - ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); - *pRetBuf = '\0'; + if(bRetNULL == 0) { + if((pRetBuf = malloc(sizeof(uchar))) == NULL) + ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); + *pRetBuf = '\0'; + } else { + pRetBuf = NULL; + } } else pRetBuf = rsCStrGetSzStr(pThis); -- cgit