mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
make sure SAX endDocument is always called as this could result in a
* parser.c: make sure SAX endDocument is always called as this could result in a Python memory leak otherwise (it's used to decrement ref-counting) * python/generator.py python/libxml.c python/libxml.py python/libxml2-python-api.xml python/libxml2class.txt python/tests/error.py python/tests/xpath.py: implemented the suggestions made by Gary Benson and extended the tests to match it. Daniel
This commit is contained in:
18
parser.c
18
parser.c
@ -7640,8 +7640,7 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
|
||||
/*
|
||||
* SAX: end of the document processing.
|
||||
*/
|
||||
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL) &&
|
||||
(!ctxt->disableSAX))
|
||||
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
|
||||
ctxt->sax->endDocument(ctxt->userData);
|
||||
|
||||
if (! ctxt->wellFormed) {
|
||||
@ -7757,8 +7756,7 @@ xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt) {
|
||||
/*
|
||||
* SAX: end of the document processing.
|
||||
*/
|
||||
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL) &&
|
||||
(!ctxt->disableSAX))
|
||||
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
|
||||
ctxt->sax->endDocument(ctxt->userData);
|
||||
|
||||
if (! ctxt->wellFormed) return(-1);
|
||||
@ -8245,8 +8243,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering EOF\n");
|
||||
#endif
|
||||
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL) &&
|
||||
(!ctxt->disableSAX))
|
||||
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
|
||||
ctxt->sax->endDocument(ctxt->userData);
|
||||
goto done;
|
||||
}
|
||||
@ -8269,8 +8266,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering EOF\n");
|
||||
#endif
|
||||
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL) &&
|
||||
(!ctxt->disableSAX))
|
||||
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
|
||||
ctxt->sax->endDocument(ctxt->userData);
|
||||
goto done;
|
||||
}
|
||||
@ -8289,8 +8285,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"PP: entering EOF\n");
|
||||
#endif
|
||||
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL) &&
|
||||
(!ctxt->disableSAX))
|
||||
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
|
||||
ctxt->sax->endDocument(ctxt->userData);
|
||||
goto done;
|
||||
}
|
||||
@ -8767,8 +8762,7 @@ xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
|
||||
ctxt->disableSAX = 1;
|
||||
}
|
||||
if (ctxt->instate != XML_PARSER_EOF) {
|
||||
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL) &&
|
||||
(!ctxt->disableSAX))
|
||||
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
|
||||
ctxt->sax->endDocument(ctxt->userData);
|
||||
}
|
||||
ctxt->instate = XML_PARSER_EOF;
|
||||
|
Reference in New Issue
Block a user