]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't leak m_protocol in wxURL.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 21 Mar 2010 11:06:26 +0000 (11:06 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 21 Mar 2010 11:06:26 +0000 (11:06 +0000)
Destroy the old protocol before creating it anew in ParseURL().

Closes #11796.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63730 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/url.cpp

index cbca1ffeb3742858085cb15c53e92479aae99dae..918923287a50f2c4ebdf8bb61817dda5d590f7d6 100644 (file)
@@ -166,6 +166,8 @@ bool wxURL::ParseURL()
             m_url = m_url + wxT("//") + m_server;
 
         // We initialize specific variables.
+        if (m_protocol)
+            m_protocol->Destroy();
         m_protocol = m_proxy; // FIXME: we should clone the protocol
     }
 #endif // wxUSE_PROTOCOL_HTTP
@@ -183,9 +185,14 @@ void wxURL::CleanData()
 #if wxUSE_PROTOCOL_HTTP
     if (!m_useProxy)
 #endif // wxUSE_PROTOCOL_HTTP
+    {
         if (m_protocol)
+        {
             // Need to safely delete the socket (pending events)
             m_protocol->Destroy();
+            m_protocol = NULL;
+        }
+    }
 }
 
 wxURL::~wxURL()