summaryrefslogtreecommitdiffstats
path: root/stringbuf.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-09-11 15:39:00 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-09-11 15:39:00 +0000
commite114e0d7e5c2df006fc89d8625274da099327e2e (patch)
tree386f5c994f49e99bd542a1d394de3e044e5e2dde /stringbuf.c
parenta24e10de791b69b0904b29b0e84bed53c5dc99b9 (diff)
downloadrsyslog-e114e0d7e5c2df006fc89d8625274da099327e2e.tar.gz
rsyslog-e114e0d7e5c2df006fc89d8625274da099327e2e.tar.xz
rsyslog-e114e0d7e5c2df006fc89d8625274da099327e2e.zip
- removed compiler warnings in non-debug modev1-19-6b
- 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)
Diffstat (limited to 'stringbuf.c')
-rwxr-xr-xstringbuf.c10
1 files changed, 7 insertions, 3 deletions
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);