From: Victor Julien Date: Tue, 5 Jul 2016 14:00:31 +0000 (+0200) Subject: lua-output: don't crash on script setup error X-Git-Tag: suricata-3.1.1~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e4d071b76f6b2d6397015dc091359ab105e04b9;p=thirdparty%2Fsuricata.git lua-output: don't crash on script setup error --- diff --git a/src/output-lua.c b/src/output-lua.c index c2aadbbbdf..eb32911337 100644 --- a/src/output-lua.c +++ b/src/output-lua.c @@ -816,12 +816,12 @@ static OutputCtx *OutputLuaLogInit(ConfNode *conf) if (unlikely(output_ctx == NULL)) { return NULL; } + output_ctx->DeInit = LogLuaMasterFree; output_ctx->data = SCCalloc(1, sizeof(LogLuaMasterCtx)); if (unlikely(output_ctx->data == NULL)) { SCFree(output_ctx); return NULL; } - output_ctx->DeInit = LogLuaMasterFree; LogLuaMasterCtx *master_config = output_ctx->data; strlcpy(master_config->path, dir, sizeof(master_config->path)); TAILQ_INIT(&output_ctx->submodules); @@ -904,9 +904,8 @@ static OutputCtx *OutputLuaLogInit(ConfNode *conf) return output_ctx; error: - if (output_ctx->DeInit && output_ctx->data) - output_ctx->DeInit(output_ctx->data); - SCFree(output_ctx); + if (output_ctx->DeInit) + output_ctx->DeInit(output_ctx); return NULL; }