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_SetDefaultHandler(parser, DefaultHnd);
|
||||||
XML_SetUnknownEncodingHandler(parser, UnknownEncodingHnd, NULL);
|
XML_SetUnknownEncodingHandler(parser, UnknownEncodingHnd, NULL);
|
||||||
|
|
||||||
|
bool ok = TRUE;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
size_t len = stream.Read(buf, BUFSIZE).LastRead();
|
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"),
|
wxLogError(_("XML parsing error: '%s' at line %d"),
|
||||||
XML_ErrorString(XML_GetErrorCode(parser)),
|
XML_ErrorString(XML_GetErrorCode(parser)),
|
||||||
XML_GetCurrentLineNumber(parser));
|
XML_GetCurrentLineNumber(parser));
|
||||||
return FALSE;
|
ok = FALSE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} while (!done);
|
} while (!done);
|
||||||
|
|
||||||
SetVersion(ctx.version);
|
if (ok)
|
||||||
SetFileEncoding(ctx.encoding);
|
{
|
||||||
SetRoot(ctx.root);
|
SetVersion(ctx.version);
|
||||||
|
SetFileEncoding(ctx.encoding);
|
||||||
|
SetRoot(ctx.root);
|
||||||
|
}
|
||||||
|
|
||||||
XML_ParserFree(parser);
|
XML_ParserFree(parser);
|
||||||
#if !wxUSE_UNICODE
|
#if !wxUSE_UNICODE
|
||||||
@@ -554,7 +559,7 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding)
|
|||||||
delete ctx.conv;
|
delete ctx.conv;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return TRUE;
|
return ok;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -531,6 +531,7 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding)
|
|||||||
XML_SetDefaultHandler(parser, DefaultHnd);
|
XML_SetDefaultHandler(parser, DefaultHnd);
|
||||||
XML_SetUnknownEncodingHandler(parser, UnknownEncodingHnd, NULL);
|
XML_SetUnknownEncodingHandler(parser, UnknownEncodingHnd, NULL);
|
||||||
|
|
||||||
|
bool ok = TRUE;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
size_t len = stream.Read(buf, BUFSIZE).LastRead();
|
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"),
|
wxLogError(_("XML parsing error: '%s' at line %d"),
|
||||||
XML_ErrorString(XML_GetErrorCode(parser)),
|
XML_ErrorString(XML_GetErrorCode(parser)),
|
||||||
XML_GetCurrentLineNumber(parser));
|
XML_GetCurrentLineNumber(parser));
|
||||||
return FALSE;
|
ok = FALSE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} while (!done);
|
} while (!done);
|
||||||
|
|
||||||
SetVersion(ctx.version);
|
if (ok)
|
||||||
SetFileEncoding(ctx.encoding);
|
{
|
||||||
SetRoot(ctx.root);
|
SetVersion(ctx.version);
|
||||||
|
SetFileEncoding(ctx.encoding);
|
||||||
|
SetRoot(ctx.root);
|
||||||
|
}
|
||||||
|
|
||||||
XML_ParserFree(parser);
|
XML_ParserFree(parser);
|
||||||
#if !wxUSE_UNICODE
|
#if !wxUSE_UNICODE
|
||||||
@@ -554,7 +559,7 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding)
|
|||||||
delete ctx.conv;
|
delete ctx.conv;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return TRUE;
|
return ok;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user