From: Victor Julien Date: Tue, 25 Jun 2013 12:14:50 +0000 (+0200) Subject: Coverity 1038124: memory leak on 'seq' keyword parsing failure X-Git-Tag: suricata-2.0beta1~95 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=db1dad8cc6a4b545946f16a91e03e6527e8e3178;p=thirdparty%2Fsuricata.git Coverity 1038124: memory leak on 'seq' keyword parsing failure --- 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; }