From: rcombs Date: Tue, 21 Oct 2014 12:08:58 +0000 (-0400) Subject: plug tcp session leak X-Git-Tag: 3.0.0-233~1352 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b56eb42fa864b809afe4be096399b5db4d5658a4;p=thirdparty%2Fsnort3.git plug tcp session leak --- diff --git a/src/stream/tcp/tcp_session.cc b/src/stream/tcp/tcp_session.cc index b6affde11..8aa6c2d5f 100644 --- a/src/stream/tcp/tcp_session.cc +++ b/src/stream/tcp/tcp_session.cc @@ -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(