From: Victor Julien Date: Mon, 3 Aug 2020 13:49:05 +0000 (+0200) Subject: unittests: check for flow memuse X-Git-Tag: suricata-6.0.0-beta1~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0aa7c1dbcc589702dccefbc3788a589418a99da;p=thirdparty%2Fsuricata.git unittests: check for flow memuse --- diff --git a/src/detect-engine-tag.c b/src/detect-engine-tag.c index f9d15a194b..9f7a5ec4e8 100644 --- a/src/detect-engine-tag.c +++ b/src/detect-engine-tag.c @@ -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(); diff --git a/src/util-unittest-helper.c b/src/util-unittest-helper.c index 1afccfdf4b..f7a459d3d1 100644 --- a/src/util-unittest-helper.c +++ b/src/util-unittest-helper.c @@ -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); } } diff --git a/src/util-unittest.c b/src/util-unittest.c index bb12bfcda0..57d5f94d03 100644 --- a/src/util-unittest.c +++ b/src/util-unittest.c @@ -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());