]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: free lookup structures
authorVictor Julien <victor@inliniac.net>
Mon, 12 Oct 2015 15:49:25 +0000 (17:49 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 5 Apr 2016 07:30:10 +0000 (09:30 +0200)
src/detect.c

index 62cbb15a8436f71bc56096a174cfd133d38e557c..7dec444935299cdf617a9be698d9a06424a54e5d 100644 (file)
@@ -3507,6 +3507,7 @@ static DetectPort *RulesGroupByPorts(DetectEngineCtx *de_ctx, int ipproto, uint3
             SigGroupHeadSetProtoAndDirection(iter->sh, ipproto, direction);
             SigGroupHeadHashAdd(de_ctx, iter->sh);
             SigGroupHeadStore(de_ctx, iter->sh);
+            iter->flags |= PORT_SIGGROUPHEAD_COPY;
             de_ctx->gh_unique++;
             own++;
         } else {
@@ -3931,6 +3932,21 @@ int SigAddressCleanupStage1(DetectEngineCtx *de_ctx)
         SigGroupHeadFree(de_ctx->decoder_event_sgh);
     de_ctx->decoder_event_sgh = NULL;
 
+    int f;
+    for (f = 0; f < FLOW_STATES; f++) {
+        int p;
+        for (p = 0; p < 256; p++) {
+            de_ctx->flow_gh[f].sgh[p] = NULL;
+        }
+
+        /* free lookup lists */
+        DetectPortCleanupList(de_ctx->flow_gh[f].tcp);
+        de_ctx->flow_gh[f].tcp = NULL;
+        DetectPortCleanupList(de_ctx->flow_gh[f].udp);
+        de_ctx->flow_gh[f].udp = NULL;
+    }
+
+
     IPOnlyDeinit(de_ctx, &de_ctx->io_ctx);
 
     if (!(de_ctx->flags & DE_QUIET)) {