From: Vadim Zeitlin Date: Tue, 20 Feb 2001 16:34:23 +0000 (+0000) Subject: fixed memory leak in Accept() X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/c3e646b47f99fd832ab29c07554b533ea8a807e4 fixed memory leak in Accept() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9398 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/socket.cpp b/src/common/socket.cpp index c5b1bab4e4..7ec0743ec1 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -481,7 +481,7 @@ wxUint32 wxSocketBase::_Write(const void *buffer, wxUint32 nbytes) { bool more = TRUE; - while (more) + while (more) { if ( !(m_flags & wxSOCKET_BLOCK) && !WaitForWrite() ) break; @@ -1010,7 +1010,7 @@ wxUint32 wxSocketBase::GetPushback(void *buffer, wxUint32 size, bool peek) // ========================================================================== -// wxSocketServer +// wxSocketServer // ========================================================================== // -------------------------------------------------------------------------- @@ -1088,7 +1088,10 @@ wxSocketBase *wxSocketServer::Accept(bool wait) sock->SetFlags(m_flags); if (!AcceptWith(*sock, wait)) - return NULL; + { + sock->Destroy(); + sock = NULL; + } return sock; }