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
This commit is contained in:
Vadim Zeitlin
2010-03-21 11:06:26 +00:00
parent 46291feecd
commit be103d4a3d

View File

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