From: Eric Leblond Date: Mon, 26 Jun 2017 16:19:39 +0000 (+0200) Subject: output-json-alert: fix error handling X-Git-Tag: suricata-4.0.0-rc1~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9323810ad6e50b6bdc23f330dd3a20ed9708f96;p=thirdparty%2Fsuricata.git output-json-alert: fix error handling MemBuffer was not freed in case of allocation error. --- diff --git a/src/output-json-alert.c b/src/output-json-alert.c index eaab38ff7d..54a472a7ea 100644 --- a/src/output-json-alert.c +++ b/src/output-json-alert.c @@ -691,10 +691,11 @@ static TmEcode JsonAlertLogThreadInit(ThreadVars *t, const void *initdata, void aft->payload_buffer = MemBufferCreateNew(json_output_ctx->payload_buffer_size); if (aft->payload_buffer == NULL) { + MemBufferFree(aft->json_buffer); SCFree(aft); return TM_ECODE_FAILED; } - + *data = (void *)aft; return TM_ECODE_OK; }