]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: delay sgh cleanup
authorVictor Julien <victor@inliniac.net>
Mon, 28 Sep 2015 14:02:15 +0000 (16:02 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 4 Apr 2016 16:14:55 +0000 (18:14 +0200)
src/detect.c

index 22a6cf870c4faba6aabda9a931890e7ae65a3f42..db6c80de871498710dc3d196c552f7fc2d638638 100644 (file)
@@ -4120,21 +4120,6 @@ int SigAddressPrepareStage3(DetectEngineCtx *de_ctx)
     /* prepare the decoder event sgh */
     DetectEngineBuildDecoderEventSgh(de_ctx);
 
-    /* cleanup group head (uri)content_array's */
-    SigGroupHeadFreeMpmArrays(de_ctx);
-    /* cleanup group head sig arrays */
-    SigGroupHeadFreeSigArrays(de_ctx);
-
-    /* cleanup the hashes now since we won't need them
-     * after the initialization phase. */
-    SigGroupHeadHashFree(de_ctx);
-    SigGroupHeadDPortHashFree(de_ctx);
-    SigGroupHeadSPortHashFree(de_ctx);
-    SigGroupHeadMpmHashFree(de_ctx);
-    SigGroupHeadMpmUriHashFree(de_ctx);
-    DetectPortDpHashFree(de_ctx);
-    DetectPortSpHashFree(de_ctx);
-
     if (!(de_ctx->flags & DE_QUIET)) {
         SCLogDebug("max sig id %" PRIu32 ", array size %" PRIu32 "", DetectEngineGetMaxSigId(de_ctx), DetectEngineGetMaxSigId(de_ctx) / 8 + 1);
         SCLogDebug("signature group heads: unique %" PRIu32 ", copies %" PRIu32 ".", de_ctx->gh_unique, de_ctx->gh_reuse);
@@ -4261,6 +4246,21 @@ int SigAddressPrepareStage4(DetectEngineCtx *de_ctx)
          * signature not decode event only. */
     }
 
+    /* cleanup group head (uri)content_array's */
+    SigGroupHeadFreeMpmArrays(de_ctx);
+    /* cleanup group head sig arrays */
+    SigGroupHeadFreeSigArrays(de_ctx);
+
+    /* cleanup the hashes now since we won't need them
+     * after the initialization phase. */
+    SigGroupHeadHashFree(de_ctx);
+    SigGroupHeadDPortHashFree(de_ctx);
+    SigGroupHeadSPortHashFree(de_ctx);
+    SigGroupHeadMpmHashFree(de_ctx);
+    SigGroupHeadMpmUriHashFree(de_ctx);
+    DetectPortDpHashFree(de_ctx);
+    DetectPortSpHashFree(de_ctx);
+
     SCFree(de_ctx->sgh_array);
     de_ctx->sgh_array_cnt = 0;
     de_ctx->sgh_array_size = 0;