Wildfire: fix memory leak.
[citadel.git] / libcitadel / lib / wildfire.c
index ff4e20f33b3b7cb3897c9acb2b7ef49c99352894..1958f5920202085358cf509045f8071452f067f4 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,