]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Coverity 1038115: memory leak on 'ack' keyword parsing failure
authorVictor Julien <victor@inliniac.net>
Tue, 25 Jun 2013 12:07:13 +0000 (14:07 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 25 Jun 2013 12:07:13 +0000 (14:07 +0200)
src/detect-ack.c

index ba0d4c16b73563b70e0ad49af18c54c9187e6084..840a718ec9b297d0edd14f271ea043fdb444bbaa 100644 (file)
@@ -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;
 
 }