Wildfire: fix memory leak.
[citadel] / libcitadel / lib / wildfire.c
index ff4e20f..1958f59 100644 (file)
@@ -373,7 +373,8 @@ void WildFireSerializePayload(StrBuf *JsonBuffer, StrBuf *OutBuf, int *MsgCount,
        const char *Cat;
        StrBuf *Header;
 
-       Header = NewStrBuf();
+       if (OutBuf == NULL)
+               Header = NewStrBuf();
        if (*MsgCount == 0) {
                if (OutBuf != NULL) {
                        StrBufAppendBufPlain(OutBuf,