]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: fix coverity memory leak warnings
authorVictor Julien <victor@inliniac.net>
Tue, 20 Nov 2018 11:22:47 +0000 (12:22 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 20 Nov 2018 11:22:47 +0000 (12:22 +0100)
src/detect-isdataat.c
src/detect-replace.c

index 654ac5ff36999c03ecc7e33daf55fd838d57d06a..36b99b595ec133d08f6e80e491d3a6681ee3f472 100644 (file)
@@ -218,7 +218,7 @@ int DetectIsdataatSetup (DetectEngineCtx *de_ctx, Signature *s, const char *isda
     int sm_list;
     if (s->init_data->list != DETECT_SM_LIST_NOTSET) {
         if (DetectBufferGetActiveList(de_ctx, s) == -1)
-            return -1;
+            goto end;
         sm_list = s->init_data->list;
 
         if (idad->flags & ISDATAAT_RELATIVE) {
index 3f9410bfad5ab9547c1486505c7645a3361468d8..3afc9395cd3b46033cdeee5c926f2586fc475dcf 100644 (file)
@@ -83,10 +83,6 @@ int DetectReplaceSetup(DetectEngineCtx *de_ctx, Signature *s, const char *replac
         return -1;
     }
 
-    int ret = DetectContentDataParse("replace", replacestr, &content, &len);
-    if (ret == -1)
-        return -1;
-
     switch (run_mode) {
         case RUNMODE_NFQ:
         case RUNMODE_IPFW:
@@ -99,6 +95,10 @@ int DetectReplaceSetup(DetectEngineCtx *de_ctx, Signature *s, const char *replac
             return 0;
     }
 
+    int ret = DetectContentDataParse("replace", replacestr, &content, &len);
+    if (ret == -1)
+        return -1;
+
     /* add to the latest "content" keyword from pmatch */
     const SigMatch *pm = DetectGetLastSMByListId(s, DETECT_SM_LIST_PMATCH,
             DETECT_CONTENT, -1);