summaryrefslogtreecommitdiffstats
path: root/stringbuf.c
diff options
context:
space:
mode:
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);