mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2024-10-26 20:25:14 +03:00
fix some problems with the *EatName functions when running out of memory
* tree.c: fix some problems with the *EatName functions when running out of memory raised by Eric Schrock , should fix #438208 Daniel svn path=/trunk/; revision=3729
This commit is contained in:
parent
bfc42632b7
commit
8f6c2b1163
@ -1,3 +1,8 @@
|
||||
Thu Apr 3 13:16:01 CEST 2008 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* tree.c: fix some problems with the *EatName functions when
|
||||
running out of memory raised by Eric Schrock , should fix #438208
|
||||
|
||||
Thu Apr 3 12:41:29 CEST 2008 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* xmlschemastypes.c: horror around the definition of the lexical
|
||||
|
17
tree.c
17
tree.c
@ -1783,7 +1783,9 @@ xmlNewPropInternal(xmlNodePtr node, xmlNsPtr ns,
|
||||
xmlDocPtr doc = NULL;
|
||||
|
||||
if ((node != NULL) && (node->type != XML_ELEMENT_NODE)) {
|
||||
if (eatname == 1)
|
||||
if ((eatname == 1) &&
|
||||
((node->doc == NULL) ||
|
||||
(!(xmlDictOwns(node->doc->dict, name) == 0))))
|
||||
xmlFree((xmlChar *) name);
|
||||
return (NULL);
|
||||
}
|
||||
@ -1793,7 +1795,9 @@ xmlNewPropInternal(xmlNodePtr node, xmlNsPtr ns,
|
||||
*/
|
||||
cur = (xmlAttrPtr) xmlMalloc(sizeof(xmlAttr));
|
||||
if (cur == NULL) {
|
||||
if (eatname == 1)
|
||||
if ((eatname == 1) &&
|
||||
((node->doc == NULL) ||
|
||||
(!(xmlDictOwns(node->doc->dict, name) == 0))))
|
||||
xmlFree((xmlChar *) name);
|
||||
xmlTreeErrMemory("building attribute");
|
||||
return (NULL);
|
||||
@ -1933,7 +1937,7 @@ xmlNewNsPropEatName(xmlNodePtr node, xmlNsPtr ns, xmlChar *name,
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
return xmlNewPropInternal(node, ns, name, value, 1);
|
||||
return xmlNewPropInternal(node, ns, name, value, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2216,8 +2220,8 @@ xmlNewNodeEatName(xmlNsPtr ns, xmlChar *name) {
|
||||
*/
|
||||
cur = (xmlNodePtr) xmlMalloc(sizeof(xmlNode));
|
||||
if (cur == NULL) {
|
||||
xmlFree(name);
|
||||
xmlTreeErrMemory("building node");
|
||||
/* we can't check here that name comes from the doc dictionnary */
|
||||
return(NULL);
|
||||
}
|
||||
memset(cur, 0, sizeof(xmlNode));
|
||||
@ -2296,6 +2300,11 @@ xmlNewDocNodeEatName(xmlDocPtr doc, xmlNsPtr ns,
|
||||
cur->children = xmlStringGetNodeList(doc, content);
|
||||
UPDATE_LAST_CHILD_AND_PARENT(cur)
|
||||
}
|
||||
} else {
|
||||
/* if name don't come from the doc dictionnary free it here */
|
||||
if ((name != NULL) && (doc != NULL) &&
|
||||
(!(xmlDictOwns(doc->dict, name))))
|
||||
xmlFree(name);
|
||||
}
|
||||
return(cur);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user