Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 370ba3d231dede4a19426a9255f45312616ec1d7 1 parent 367df6e
Daniel Veillard authored
View
5 ChangeLog
@@ -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
View
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))
View
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);
}
View
14 result/ent10
@@ -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>
View
14 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
View
8 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
View
31 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),
+ <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()
View
18 result/noent/ent10
@@ -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>
View
21 test/ent10
@@ -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>
+
View
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);
Please sign in to comment.
Something went wrong with that request. Please try again.