From 6d9f879c05acd7ae41c169da3a137657c903c11b Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 24 Apr 2020 10:27:18 +0200 Subject: [PATCH] fastlog: fix unlikely memleak Fix memleak is case of alloc error during startup. (cherry picked from commit 28837b203e45a8cc24b4b7b97f7bf9c5e118eb7b) --- src/alert-fastlog.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/alert-fastlog.c b/src/alert-fastlog.c index 46f4f7ed3b..fcddb7cbcd 100644 --- a/src/alert-fastlog.c +++ b/src/alert-fastlog.c @@ -238,8 +238,11 @@ OutputInitResult AlertFastLogInitCtx(ConfNode *conf) } OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx)); - if (unlikely(output_ctx == NULL)) + if (unlikely(output_ctx == NULL)) { + LogFileFreeCtx(logfile_ctx); return result; + } + output_ctx->data = logfile_ctx; output_ctx->DeInit = AlertFastLogDeInitCtx; -- 2.47.2