Commit e2161a69 authored by Daniel Veillard's avatar Daniel Veillard
Browse files

fix a nasty problem with reading over the end fix a reported memory leak

* xmlreader.c: fix a nasty problem with reading over the end
* xmlsave.c: fix a reported memory leak apparently
Daniel
parent 9ea6231e
Thu Apr 29 20:15:20 CEST 2004 Daniel Veillard <daniel@veillard.com>
* xmlreader.c: fix a nasty problem with reading over the end
* xmlsave.c: fix a reported memory leak apparently
Thu Apr 29 17:05:00 CEST 2004 Daniel Veillard <daniel@veillard.com>
 
* win32/Makefile.msvc: patch from Mark Vakoc for regression tests
......
......@@ -1179,6 +1179,8 @@ xmlTextReaderRead(xmlTextReaderPtr reader) {
fprintf(stderr, "\nREAD ");
DUMP_READER
#endif
if (reader->mode == XML_TEXTREADER_DONE)
return(0);
reader->curnode = NULL;
if (reader->mode == XML_TEXTREADER_MODE_INITIAL) {
reader->mode = XML_TEXTREADER_MODE_INTERACTIVE;
......@@ -1215,12 +1217,15 @@ xmlTextReaderRead(xmlTextReaderPtr reader) {
oldnode = reader->node;
get_next_node:
if (reader->node == NULL)
return(-1);
/*
* If we are not backtracking on ancestors or examined nodes,
* that the parser didn't finished or that we arent at the end
* of stream, continue processing.
*/
while ((reader->node->next == NULL) &&
while ((reader->node != NULL) && (reader->node->next == NULL) &&
(reader->ctxt->nodeNr == olddepth) &&
((oldstate == XML_TEXTREADER_BACKTRACK) ||
(reader->node->children == NULL) ||
......
......@@ -179,6 +179,8 @@ xmlFreeSaveCtxt(xmlSaveCtxtPtr ctxt)
if (ctxt == NULL) return;
if (ctxt->encoding != NULL)
xmlFree((char *) ctxt->encoding);
if (ctxt->buf != NULL)
xmlOutputBufferClose(ctxt->buf);
xmlFree(ctxt);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment