From: Victor Julien Date: Fri, 10 Apr 2020 08:02:43 +0000 (+0200) Subject: detect/parse: properly free bidir sigs in error path X-Git-Tag: suricata-5.0.3~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c0735495ffdaa6f507280038b6da09e7af1f64d;p=thirdparty%2Fsuricata.git detect/parse: properly free bidir sigs in error path (cherry picked from commit fc6ada85411caa9c08df3eae1cc908436a4ea257) --- 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; }