Commit 370ba3d2 authored by Daniel Veillard's avatar Daniel Veillard

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
parent 367df6e7
Mon Oct 25 17:11:37 CEST 2004 Daniel Veillard <daniel@veillard.com>
* 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 <wbrack@mmm.com.hk>
* valid.c: unlinked the internal subset within xmlValidateDtd
......
......@@ -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))
......
......@@ -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);
}
......
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE rnode [
<!ELEMENT rnode (f)>
<!ELEMENT f (#PCDATA)>
<!ATTLIST f att1 CDATA #FIXED "J">
<!ENTITY f "
<f>
hello world
</f>
">
]>
<rnode>
&f;
</rnode>
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
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
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),
<f>
hello world
</f>
)
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()
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE rnode [
<!ELEMENT rnode (f)>
<!ELEMENT f (#PCDATA)>
<!ATTLIST f att1 CDATA #FIXED "J">
<!ENTITY f "
<f>
hello world
</f>
">
]>
<rnode>
<f>
hello world
</f>
</rnode>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE rnode [
<!ELEMENT rnode (f)>
<!ELEMENT f (#PCDATA)>
<!ATTLIST f
att1 CDATA #FIXED 'J'>
<!ENTITY f
"
<f>
hello world
</f>
"
>
]>
<rnode>
&f;
</rnode>
......@@ -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);
......
Markdown is supported
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