From: Vadim Zeitlin Date: Sun, 21 Mar 2010 11:06:26 +0000 (+0000) Subject: Don't leak m_protocol in wxURL. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/be103d4a3d79b507fa514587d792e8bdcfa89a7c Don't leak m_protocol in wxURL. 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 --- diff --git a/src/common/url.cpp b/src/common/url.cpp index cbca1ffeb3..918923287a 100644 --- a/src/common/url.cpp +++ b/src/common/url.cpp @@ -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()