From 778851626c1ba71242fbaf232fe2d9bb819a2428 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 25 Jun 2013 14:07:13 +0200 Subject: [PATCH] Coverity 1038115: memory leak on 'ack' keyword parsing failure --- src/detect-ack.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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; }