1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-23 01:52:48 +03:00

fixed the leak reported by Volker Roth on the list added a specific test

* parser.c: fixed the leak reported by Volker Roth on the list
* test/ent10 result//ent10*: added a specific test for the problem
Daniel
This commit is contained in:
Daniel Veillard
2004-10-25 16:23:56 +00:00
parent 367df6e7e1
commit 370ba3d231
10 changed files with 119 additions and 4 deletions

View File

@@ -5692,16 +5692,20 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
xmlAddEntityReference(ent, firstChild, nw);
#endif /* LIBXML_LEGACY_ENABLED */
} else {
const xmlChar *nbktext;
/*
* the name change is to avoid coalescing of the
* node with a possible previous text one which
* would make ent->children a dangling pointer
*/
nbktext = xmlDictLookup(ctxt->dict, BAD_CAST "nbktext",
-1);
if (ent->children->type == XML_TEXT_NODE)
ent->children->name = xmlStrdup(BAD_CAST "nbktext");
ent->children->name = nbktext;
if ((ent->last != ent->children) &&
(ent->last->type == XML_TEXT_NODE))
ent->last->name = xmlStrdup(BAD_CAST "nbktext");
ent->last->name = nbktext;
xmlAddChildList(ctxt->node, ent->children);
}