From: Jeff Lucovsky Date: Tue, 21 Sep 2021 13:52:11 +0000 (-0400) Subject: log: Coverity REVERSE_INULL warnings X-Git-Tag: suricata-7.0.0-beta1~1069 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22e89ec4a3554a66ecf8c38e5b6fcfc95d4107e9;p=thirdparty%2Fsuricata.git log: Coverity REVERSE_INULL warnings This commit addresses Coverity reported "REVERSE_INULL" warnings. Issue: 4699 --- diff --git a/src/output-json.c b/src/output-json.c index 04bd6ed159..3ff8d1bb0e 100644 --- a/src/output-json.c +++ b/src/output-json.c @@ -1099,8 +1099,7 @@ OutputInitResult OutputJsonInitCtx(ConfNode *conf) json_ctx->file_ctx = LogFileNewCtx(); if (unlikely(json_ctx->file_ctx == NULL)) { SCLogDebug("AlertJsonInitCtx: Could not create new LogFileCtx"); - SCFree(json_ctx); - return result; + goto error_exit; } if (sensor_name) { @@ -1238,11 +1237,16 @@ OutputInitResult OutputJsonInitCtx(ConfNode *conf) error_exit: if (json_ctx->file_ctx) { + if (json_ctx->file_ctx->prefix) { + SCFree(json_ctx->file_ctx->prefix); + } + if (json_ctx->file_ctx->sensor_name) { + SCFree(json_ctx->file_ctx->sensor_name); + } LogFileFreeCtx(json_ctx->file_ctx); } - if (json_ctx) { - SCFree(json_ctx); - } + SCFree(json_ctx); + if (output_ctx) { SCFree(output_ctx); }