From: Victor Julien Date: Tue, 25 Jun 2013 12:07:13 +0000 (+0200) Subject: Coverity 1038115: memory leak on 'ack' keyword parsing failure X-Git-Tag: suricata-2.0beta1~98 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=778851626c1ba71242fbaf232fe2d9bb819a2428;p=thirdparty%2Fsuricata.git Coverity 1038115: memory leak on 'ack' keyword parsing failure --- diff --git a/src/detect-ack.c b/src/detect-ack.c index ba0d4c16b7..840a718ec9 100644 --- a/src/detect-ack.c +++ b/src/detect-ack.c @@ -95,7 +95,7 @@ static int DetectAckMatch(ThreadVars *t, DetectEngineThreadCtx *det_ctx, */ static int DetectAckSetup(DetectEngineCtx *de_ctx, Signature *s, char *optstr) { - DetectAckData *data; + DetectAckData *data = NULL; SigMatch *sm = NULL; data = SCMalloc(sizeof(DetectAckData)); @@ -103,9 +103,8 @@ static int DetectAckSetup(DetectEngineCtx *de_ctx, Signature *s, char *optstr) goto error; sm = SigMatchAlloc(); - if (sm == NULL) { + if (sm == NULL) goto error; - } sm->type = DETECT_ACK; @@ -120,7 +119,10 @@ static int DetectAckSetup(DetectEngineCtx *de_ctx, Signature *s, char *optstr) return 0; error: - if (data) SCFree(data); + if (data) + SCFree(data); + if (sm) + SigMatchFree(sm); return -1; }