From 3c0735495ffdaa6f507280038b6da09e7af1f64d Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 10 Apr 2020 10:02:43 +0200 Subject: [PATCH] detect/parse: properly free bidir sigs in error path (cherry picked from commit fc6ada85411caa9c08df3eae1cc908436a4ea257) --- src/detect-parse.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/detect-parse.c b/src/detect-parse.c index 8c10e0dc3f..3c185588ad 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -2339,8 +2339,14 @@ Signature *DetectEngineAppendSig(DetectEngineCtx *de_ctx, const char *sigstr) return (dup_sig == 0 || dup_sig == 2) ? sig : NULL; error: - if (sig != NULL) + /* free the 2nd sig bidir may have set up */ + if (sig != NULL && sig->next != NULL) { + SigFree(sig->next); + sig->next = NULL; + } + if (sig != NULL) { SigFree(sig); + } return NULL; } -- 2.47.2