From db1dad8cc6a4b545946f16a91e03e6527e8e3178 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 25 Jun 2013 14:14:50 +0200 Subject: [PATCH] Coverity 1038124: memory leak on 'seq' keyword parsing failure --- src/detect-seq.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/detect-seq.c b/src/detect-seq.c index f41f854512..db78e07bc2 100644 --- a/src/detect-seq.c +++ b/src/detect-seq.c @@ -94,7 +94,7 @@ static int DetectSeqMatch(ThreadVars *t, DetectEngineThreadCtx *det_ctx, */ static int DetectSeqSetup (DetectEngineCtx *de_ctx, Signature *s, char *optstr) { - DetectSeqData *data; + DetectSeqData *data = NULL; SigMatch *sm = NULL; data = SCMalloc(sizeof(DetectSeqData)); @@ -102,9 +102,8 @@ static int DetectSeqSetup (DetectEngineCtx *de_ctx, Signature *s, char *optstr) goto error; sm = SigMatchAlloc(); - if (sm == NULL) { + if (sm == NULL) goto error; - } sm->type = DETECT_SEQ; @@ -119,7 +118,10 @@ static int DetectSeqSetup (DetectEngineCtx *de_ctx, Signature *s, char *optstr) return 0; error: - if (data) SCFree(data); + if (data) + SCFree(data); + if (sm) + SigMatchFree(sm); return -1; }