diff --git a/ChangeLog b/ChangeLog index 6d0f51f4..50bf70b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Apr 29 20:15:20 CEST 2004 Daniel Veillard + + * 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 * win32/Makefile.msvc: patch from Mark Vakoc for regression tests diff --git a/xmlreader.c b/xmlreader.c index f1757593..75b73ffe 100644 --- a/xmlreader.c +++ b/xmlreader.c @@ -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) || diff --git a/xmlsave.c b/xmlsave.c index 1a60a315..6e314164 100644 --- a/xmlsave.c +++ b/xmlsave.c @@ -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); }