]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2049 in SNORT/snort3 from ~SMINUT/snort3:flow_mem_leak to master
authorMike Stepanek (mstepane) <mstepane@cisco.com>
Thu, 5 Mar 2020 17:26:43 +0000 (17:26 +0000)
committerMike Stepanek (mstepane) <mstepane@cisco.com>
Thu, 5 Mar 2020 17:26:43 +0000 (17:26 +0000)
Squashed commit of the following:

commit ac638bb058bbb634528feb5d666a46e85d53efdb
Author: Silviu Minut <sminut@cisco.com>
Date:   Fri Feb 28 16:05:33 2020 -0500

    flow: free the flow data before deleting the actual flow

src/flow/flow.cc
src/flow/test/flow_cache_test.cc

index f6b4ca4cda14015540d63852a398f36a6617b6b8..d9a2e2fd5f83dac1ede938bd186d4e22fd9219ea 100644 (file)
@@ -108,7 +108,8 @@ void Flow::term()
     delete session;
     session = nullptr;
 
-    assert(!flow_data);
+    if ( flow_data )
+        free_flow_data();
 
     if ( mpls_client.length )
         delete[] mpls_client.start;
@@ -140,6 +141,9 @@ void Flow::term()
     if (assistant_gadget)
         assistant_gadget->rem_ref();
 
+    if ( data )
+        clear_data();
+
     if ( ha_state )
         delete ha_state;
 
index 21f7e77641f0869fdbfb6c1a3303521392f9c013..45415f866d6119731569efa6c3b9d1045e6fb85b 100644 (file)
@@ -69,6 +69,7 @@ DetectionEngine::~DetectionEngine() { }
 void Flow::init(PktType) { }
 void Flow::term() { }
 void Flow::reset(bool) { }
+void Flow::free_flow_data() { }
 void set_network_policy(SnortConfig*, unsigned) { }
 void DataBus::publish(const char*, const uint8_t*, unsigned, Flow*) { }
 void DataBus::publish(const char*, Packet*, Flow*) { }