diff --git a/ChangeLog b/ChangeLog index b7c0bdae..e8805488 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Oct 25 17:11:37 CEST 2004 Daniel Veillard + + * parser.c: fixed the leak reported by Volker Roth on the list + * test/ent10 result//ent10*: added a specific test for the problem + Sat Oct 23 11:07:41 PDT 2004 William Brack * valid.c: unlinked the internal subset within xmlValidateDtd diff --git a/error.c b/error.c index b0660d81..9b8ddc42 100644 --- a/error.c +++ b/error.c @@ -453,7 +453,7 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, return; if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) || (domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) || - (domain == XML_FROM_IO)) { + (domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) { ctxt = (xmlParserCtxtPtr) ctx; if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC)) diff --git a/parser.c b/parser.c index f7d971f0..053fdc37 100644 --- a/parser.c +++ b/parser.c @@ -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); } diff --git a/result/ent10 b/result/ent10 new file mode 100644 index 00000000..c46d19fb --- /dev/null +++ b/result/ent10 @@ -0,0 +1,14 @@ + + + + + + hello world + + "> +]> + + &f; + diff --git a/result/ent10.rde b/result/ent10.rde new file mode 100644 index 00000000..e69594cd --- /dev/null +++ b/result/ent10.rde @@ -0,0 +1,14 @@ +0 10 rnode 0 0 +0 1 rnode 0 0 +1 14 #text 0 1 + + +1 1 f 0 0 +2 3 #text 0 1 + hello world + +1 15 f 0 0 +1 14 #text 0 1 + + +0 15 rnode 0 0 diff --git a/result/ent10.rdr b/result/ent10.rdr new file mode 100644 index 00000000..34edb50f --- /dev/null +++ b/result/ent10.rdr @@ -0,0 +1,8 @@ +0 10 rnode 0 0 +0 1 rnode 0 0 +1 14 #text 0 1 + +1 5 f 0 0 +1 14 #text 0 1 + +0 15 rnode 0 0 diff --git a/result/ent10.sax b/result/ent10.sax new file mode 100644 index 00000000..75ed20ac --- /dev/null +++ b/result/ent10.sax @@ -0,0 +1,31 @@ +SAX.setDocumentLocator() +SAX.startDocument() +SAX.internalSubset(rnode, , ) +SAX.elementDecl(rnode, 4, ...) +SAX.elementDecl(f, 3, ...) +SAX.attributeDecl(f, att1, 1, 4, J, ...) +SAX.entityDecl(f, 1, (null), (null), + + hello world + + ) +SAX.getEntity(f) +SAX.externalSubset(rnode, , ) +SAX.startElement(rnode) +SAX.characters( + , 4) +SAX.getEntity(f) +SAX.ignorableWhitespace( + , 4) +SAX.startElement(f) +SAX.characters( + hello world + , 19) +SAX.endElement(f) +SAX.characters( + , 4) +SAX.reference(f) +SAX.characters( +, 1) +SAX.endElement(rnode) +SAX.endDocument() diff --git a/result/noent/ent10 b/result/noent/ent10 new file mode 100644 index 00000000..946aff8d --- /dev/null +++ b/result/noent/ent10 @@ -0,0 +1,18 @@ + + + + + + hello world + + "> +]> + + + + hello world + + + diff --git a/test/ent10 b/test/ent10 new file mode 100644 index 00000000..4778d894 --- /dev/null +++ b/test/ent10 @@ -0,0 +1,21 @@ + + + + + + + + hello world + + " +> +]> + + + &f; + + diff --git a/tree.c b/tree.c index 87c45560..bf112caa 100644 --- a/tree.c +++ b/tree.c @@ -5081,7 +5081,7 @@ xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content) { case XML_COMMENT_NODE: if (cur->content != NULL) { if (!((cur->doc != NULL) && (cur->doc->dict != NULL) && - xmlDictOwns(cur->doc->dict, cur->content))) + (!xmlDictOwns(cur->doc->dict, cur->content)))) xmlFree(cur->content); } if (cur->children != NULL) xmlFreeNodeList(cur->children);