From: Vadim Zeitlin Date: Tue, 7 Mar 2006 23:16:58 +0000 (+0000) Subject: fixed a memory leak in case server name couldn't be resolved in MakeConnection()... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e1026179ef66aff49c44b5c6cdcbe68c938f33a3 fixed a memory leak in case server name couldn't be resolved in MakeConnection() (coverity checker CID 56) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37877 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/sckipc.cpp b/src/common/sckipc.cpp index 9a9b4c62b8..9787f76858 100644 --- a/src/common/sckipc.cpp +++ b/src/common/sckipc.cpp @@ -163,15 +163,15 @@ wxConnectionBase *wxTCPClient::MakeConnection (const wxString& host, const wxString& serverName, const wxString& topic) { + wxSockAddress *addr = GetAddressFromName(serverName, host); + if ( !addr ) + return NULL; + wxSocketClient *client = new wxSocketClient(SCKIPC_FLAGS); wxSocketStream *stream = new wxSocketStream(*client); wxDataInputStream *data_is = new wxDataInputStream(*stream); wxDataOutputStream *data_os = new wxDataOutputStream(*stream); - wxSockAddress *addr = GetAddressFromName(serverName, host); - if ( !addr ) - return NULL; - bool ok = client->Connect(*addr); delete addr;