fixed memory leak in wxHTTP

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13336 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2002-01-03 17:18:38 +00:00
parent 761df41e86
commit 2fb203e6ef
3 changed files with 15 additions and 6 deletions

View File

@ -68,6 +68,7 @@ wxBase:
- fixes to the command line parsing error and usage messages
- modified wxFileName::CreateTempFileName() to open the file atomically
(if possible) and, especially, not to leak the file descriptors under Unix
- memory leak in wxHTTP fixed (Dimitri)
All (GUI):
@ -82,6 +83,7 @@ wxMSW:
- fixed redraw problems in dynamically resized wxStaticText
- fixed wxProgressDialog for ranges > 65535
- wxFontEnumerator now returns all fonts, not only TrueType ones
- wxTextCtrl with wxTE_RICH flag scrolls to the end when text is appended to it
2.3.2
-----

View File

@ -50,6 +50,9 @@ protected:
bool BuildRequest(const wxString& path, wxHTTP_Req req);
void SendHeaders();
bool ParseHeaders();
// deletes the header value strings
void ClearHeaders();
};
#endif // wxUSE_PROTOCOL_HTTP

View File

@ -49,6 +49,13 @@ wxHTTP::wxHTTP()
}
wxHTTP::~wxHTTP()
{
ClearHeaders();
delete m_addr;
}
void wxHTTP::ClearHeaders()
{
// wxString isn't a wxObject
wxNode *node = m_headers.First();
@ -60,10 +67,7 @@ wxHTTP::~wxHTTP()
node = node->Next();
}
if (m_addr) {
delete m_addr;
m_addr = NULL;
}
m_headers.Clear();
}
wxString wxHTTP::GetContentType()
@ -79,7 +83,7 @@ void wxHTTP::SetProxyMode(bool on)
void wxHTTP::SetHeader(const wxString& header, const wxString& h_data)
{
if (m_read) {
m_headers.Clear();
ClearHeaders();
m_read = FALSE;
}
@ -130,7 +134,7 @@ bool wxHTTP::ParseHeaders()
wxString line;
wxStringTokenizer tokenzr;
m_headers.Clear();
ClearHeaders();
m_read = TRUE;
#if defined(__VISAGECPP__)