--- src/internet/model/tcp-socket-base.cc 2014-09-18 04:03:14.000000000 +0100 +++ src/internet/model/tcp-socket-base.cc 2014-10-17 11:01:05.067210136 +0100 @@ -806,6 +806,8 @@ void TcpSocketBase::CloseAndNotify (void) { + Ptr l_ptr = (m_state == TIME_WAIT ? this : 0); + NS_LOG_FUNCTION (this); if (!m_closeNotified) @@ -813,11 +815,7 @@ NotifyNormalClose (); } - if (m_state != TIME_WAIT) - { - DeallocateEndPoint (); - } - + DeallocateEndPoint (); m_closeNotified = true; NS_LOG_INFO (TcpStateName[m_state] << " -> CLOSED"); CancelAllTimers ();