]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
plug tcp session leak
authorrcombs <rcombs@sq18.sfeng.sourcefire.com>
Tue, 21 Oct 2014 12:08:58 +0000 (08:08 -0400)
committerrcombs <rcombs@sq18.sfeng.sourcefire.com>
Tue, 21 Oct 2014 12:08:58 +0000 (08:08 -0400)
src/stream/tcp/tcp_session.cc

index b6affde11dfa5e0be225199943c0532bc3d9099d..8aa6c2d5fe53308c91f4aa4f7f72eba9645c8645 100644 (file)
@@ -6565,6 +6565,7 @@ char Stream5PacketsMissingTcp(Flow *lwssn, char dir)
 
 TcpSession::TcpSession(Flow* flow) : Session(flow)
 {
+    lws_init = tcp_init = false;
 }
 
 TcpSession::~TcpSession()
@@ -6575,14 +6576,15 @@ TcpSession::~TcpSession()
 
 void TcpSession::reset()
 {
-    if ( !tcp_init )
-        return;
-
-    TcpSessionClear(flow, (TcpSession*)flow->session, 2);
+    if ( tcp_init )
+        TcpSessionClear(flow, (TcpSession*)flow->session, 2);
 }
 
 bool TcpSession::setup (Packet*)
 {
+    // FIXIT-L this it should not be necessary to reset here
+    reset();
+
     lws_init = tcp_init = false;
     ecn = 0;
 
@@ -6609,8 +6611,9 @@ void TcpSession::cleanup()
 // which is now calling Session::clear()
 void TcpSession::clear()
 {
-    // this does NOT flush data
-    TcpSessionClear(flow, this, 1);
+    if ( tcp_init )
+        // this does NOT flush data
+        TcpSessionClear(flow, this, 1);
 }
 
 void TcpSession::update_direction(