From 5e4d071b76f6b2d6397015dc091359ab105e04b9 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 5 Jul 2016 16:00:31 +0200 Subject: [PATCH] lua-output: don't crash on script setup error --- src/output-lua.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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; } -- 2.47.2