]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed a memory leak in case server name couldn't be resolved in MakeConnection()...
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 7 Mar 2006 23:16:58 +0000 (23:16 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 7 Mar 2006 23:16:58 +0000 (23:16 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37877 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/sckipc.cpp

index 9a9b4c62b8dc1fec3470820418875fdd5bc7fb6f..9787f76858fa1f5507634970f4296b38adfd7522 100644 (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;