fixed memory leak
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20243 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -531,6 +531,7 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding)
|
||||
XML_SetDefaultHandler(parser, DefaultHnd);
|
||||
XML_SetUnknownEncodingHandler(parser, UnknownEncodingHnd, NULL);
|
||||
|
||||
bool ok = TRUE;
|
||||
do
|
||||
{
|
||||
size_t len = stream.Read(buf, BUFSIZE).LastRead();
|
||||
@@ -540,13 +541,17 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding)
|
||||
wxLogError(_("XML parsing error: '%s' at line %d"),
|
||||
XML_ErrorString(XML_GetErrorCode(parser)),
|
||||
XML_GetCurrentLineNumber(parser));
|
||||
return FALSE;
|
||||
ok = FALSE;
|
||||
break;
|
||||
}
|
||||
} while (!done);
|
||||
|
||||
SetVersion(ctx.version);
|
||||
SetFileEncoding(ctx.encoding);
|
||||
SetRoot(ctx.root);
|
||||
if (ok)
|
||||
{
|
||||
SetVersion(ctx.version);
|
||||
SetFileEncoding(ctx.encoding);
|
||||
SetRoot(ctx.root);
|
||||
}
|
||||
|
||||
XML_ParserFree(parser);
|
||||
#if !wxUSE_UNICODE
|
||||
@@ -554,7 +559,7 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding)
|
||||
delete ctx.conv;
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
return ok;
|
||||
|
||||
}
|
||||
|
||||
|
@@ -531,6 +531,7 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding)
|
||||
XML_SetDefaultHandler(parser, DefaultHnd);
|
||||
XML_SetUnknownEncodingHandler(parser, UnknownEncodingHnd, NULL);
|
||||
|
||||
bool ok = TRUE;
|
||||
do
|
||||
{
|
||||
size_t len = stream.Read(buf, BUFSIZE).LastRead();
|
||||
@@ -540,13 +541,17 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding)
|
||||
wxLogError(_("XML parsing error: '%s' at line %d"),
|
||||
XML_ErrorString(XML_GetErrorCode(parser)),
|
||||
XML_GetCurrentLineNumber(parser));
|
||||
return FALSE;
|
||||
ok = FALSE;
|
||||
break;
|
||||
}
|
||||
} while (!done);
|
||||
|
||||
SetVersion(ctx.version);
|
||||
SetFileEncoding(ctx.encoding);
|
||||
SetRoot(ctx.root);
|
||||
if (ok)
|
||||
{
|
||||
SetVersion(ctx.version);
|
||||
SetFileEncoding(ctx.encoding);
|
||||
SetRoot(ctx.root);
|
||||
}
|
||||
|
||||
XML_ParserFree(parser);
|
||||
#if !wxUSE_UNICODE
|
||||
@@ -554,7 +559,7 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding)
|
||||
delete ctx.conv;
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
return ok;
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user