]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
fastlog: fix unlikely memleak 4884/head
authorVictor Julien <victor@inliniac.net>
Fri, 24 Apr 2020 08:27:18 +0000 (10:27 +0200)
committerVictor Julien <victor@inliniac.net>
Sun, 26 Apr 2020 08:49:55 +0000 (10:49 +0200)
Fix memleak is case of alloc error during startup.

(cherry picked from commit 28837b203e45a8cc24b4b7b97f7bf9c5e118eb7b)

src/alert-fastlog.c

index 46f4f7ed3bf9af678158cec30c3b6f19e68d3e24..fcddb7cbcdb2e54a2eb309cf52b67a781584329d 100644 (file)
@@ -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;