From: Victor Julien Date: Wed, 24 Feb 2016 15:19:13 +0000 (+0100) Subject: json-drop-log: clean up memory at shutdown X-Git-Tag: suricata-3.0.1RC1~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=609cdff540c1ebd2a5a87988a4eba81f2802661a;p=thirdparty%2Fsuricata.git json-drop-log: clean up memory at shutdown --- diff --git a/src/output-json-drop.c b/src/output-json-drop.c index f82c9c00db..f93c22f4db 100644 --- a/src/output-json-drop.c +++ b/src/output-json-drop.c @@ -218,12 +218,21 @@ static TmEcode JsonDropLogThreadDeinit(ThreadVars *t, void *data) return TM_ECODE_OK; } +static void JsonDropOutputCtxFree(JsonDropOutputCtx *drop_ctx) +{ + if (drop_ctx != NULL) { + if (drop_ctx->file_ctx != NULL) + LogFileFreeCtx(drop_ctx->file_ctx); + SCFree(drop_ctx); + } +} + static void JsonDropLogDeInitCtx(OutputCtx *output_ctx) { OutputDropLoggerDisable(); - LogFileCtx *logfile_ctx = (LogFileCtx *)output_ctx->data; - LogFileFreeCtx(logfile_ctx); + JsonDropOutputCtx *drop_ctx = output_ctx->data; + JsonDropOutputCtxFree(drop_ctx); SCFree(output_ctx); } @@ -231,19 +240,12 @@ static void JsonDropLogDeInitCtxSub(OutputCtx *output_ctx) { OutputDropLoggerDisable(); + JsonDropOutputCtx *drop_ctx = output_ctx->data; + SCFree(drop_ctx); SCLogDebug("cleaning up sub output_ctx %p", output_ctx); SCFree(output_ctx); } -static void JsonDropOutputCtxFree(JsonDropOutputCtx *drop_ctx) -{ - if (drop_ctx != NULL) { - if (drop_ctx->file_ctx != NULL) - LogFileFreeCtx(drop_ctx->file_ctx); - SCFree(drop_ctx); - } -} - #define DEFAULT_LOG_FILENAME "drop.json" static OutputCtx *JsonDropLogInitCtx(ConfNode *conf) {