mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-27 18:50:07 +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:
parent
367df6e7e1
commit
370ba3d231
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
2
error.c
2
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))
|
||||
|
8
parser.c
8
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);
|
||||
}
|
||||
|
||||
|
14
result/ent10
Normal file
14
result/ent10
Normal file
@ -0,0 +1,14 @@
|
||||
<?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>
|
14
result/ent10.rde
Normal file
14
result/ent10.rde
Normal file
@ -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
|
8
result/ent10.rdr
Normal file
8
result/ent10.rdr
Normal file
@ -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
|
31
result/ent10.sax
Normal file
31
result/ent10.sax
Normal file
@ -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),
|
||||
<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()
|
18
result/noent/ent10
Normal file
18
result/noent/ent10
Normal file
@ -0,0 +1,18 @@
|
||||
<?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>
|
21
test/ent10
Normal file
21
test/ent10
Normal file
@ -0,0 +1,21 @@
|
||||
<?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>
|
||||
|
2
tree.c
2
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user