]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
unittests: check for flow memuse
authorVictor Julien <victor@inliniac.net>
Mon, 3 Aug 2020 13:49:05 +0000 (15:49 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 6 Aug 2020 09:43:46 +0000 (11:43 +0200)
src/detect-engine-tag.c
src/util-unittest-helper.c
src/util-unittest.c

index f9d15a194b06e8cad6117b335c87e239821cfc06..9f7a5ec4e8850215d33d8f8837fec8c9ae91b7b8 100644 (file)
@@ -1053,6 +1053,7 @@ cleanup:
     uint8_t proto_map = FlowGetProtoMapping(f->proto);
     FlowClearMemory(f, proto_map);
     FLOW_DESTROY(f);
+    FlowFree(f);
 end:
     FlowShutdown();
     HostShutdown();
@@ -1199,6 +1200,7 @@ cleanup:
     uint8_t proto_map = FlowGetProtoMapping(f->proto);
     FlowClearMemory(f, proto_map);
     FLOW_DESTROY(f);
+    FlowFree(f);
 end:
     FlowShutdown();
     HostShutdown();
@@ -1341,6 +1343,7 @@ cleanup:
     uint8_t proto_map = FlowGetProtoMapping(f->proto);
     FlowClearMemory(f, proto_map);
     FLOW_DESTROY(f);
+    FlowFree(f);
 end:
     FlowShutdown();
     HostShutdown();
@@ -1484,6 +1487,7 @@ cleanup:
     uint8_t proto_map = FlowGetProtoMapping(f->proto);
     FlowClearMemory(f, proto_map);
     FLOW_DESTROY(f);
+    FlowFree(f);
 end:
     FlowShutdown();
     HostShutdown();
index 1afccfdf4b6e5a157916e0d34c70a894e11c09c9..f7a459d3d13c2f04d62514c732b2f931d53397b3 100644 (file)
@@ -525,7 +525,7 @@ Flow *UTHBuildFlow(int family, const char *src, const char *dst, Port sp, Port d
 void UTHFreeFlow(Flow *flow)
 {
     if (flow != NULL) {
-        FlowFree(flow);
+        SCFree(flow);//FlowFree(flow);
     }
 }
 
index bb12bfcda0914e1ff33d2459d5030adb8f9670a9..57d5f94d03d0d7d7bce620b606452cd32bf4432a 100644 (file)
@@ -217,6 +217,10 @@ uint32_t UtRunTests(const char *regex_arg)
                     printf("STREAM MEMORY IN USE %"PRIu64"\n", StreamTcpMemuseCounter());
                     ret = 0;
                 }
+                if (FlowGetMemuse() != 0) {
+                    printf("FLOW MEMORY IN USE %"PRIu64"\n", FlowGetMemuse());
+                    ret = 0;
+                }
 
                 if (StreamTcpReassembleMemuseGlobalCounter() != 0) {
                     printf("STREAM REASSEMBLY MEMORY IN USE %"PRIu64"\n", StreamTcpReassembleMemuseGlobalCounter());