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:
@@ -163,15 +163,15 @@ wxConnectionBase *wxTCPClient::MakeConnection (const wxString& host,
|
|||||||
const wxString& serverName,
|
const wxString& serverName,
|
||||||
const wxString& topic)
|
const wxString& topic)
|
||||||
{
|
{
|
||||||
|
wxSockAddress *addr = GetAddressFromName(serverName, host);
|
||||||
|
if ( !addr )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
wxSocketClient *client = new wxSocketClient(SCKIPC_FLAGS);
|
wxSocketClient *client = new wxSocketClient(SCKIPC_FLAGS);
|
||||||
wxSocketStream *stream = new wxSocketStream(*client);
|
wxSocketStream *stream = new wxSocketStream(*client);
|
||||||
wxDataInputStream *data_is = new wxDataInputStream(*stream);
|
wxDataInputStream *data_is = new wxDataInputStream(*stream);
|
||||||
wxDataOutputStream *data_os = new wxDataOutputStream(*stream);
|
wxDataOutputStream *data_os = new wxDataOutputStream(*stream);
|
||||||
|
|
||||||
wxSockAddress *addr = GetAddressFromName(serverName, host);
|
|
||||||
if ( !addr )
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
bool ok = client->Connect(*addr);
|
bool ok = client->Connect(*addr);
|
||||||
delete addr;
|
delete addr;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user