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
This commit is contained in:
Vadim Zeitlin
2006-03-07 23:16:58 +00:00
parent c56ae04274
commit e1026179ef

View File

@@ -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;