mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-15 23:24:06 +03:00
malloc-fail: Fix memory leak in xmlNewPropInternal
Also fixes a memory leak if called with a non-element node. Found with libFuzzer, see #344.
This commit is contained in:
parent
865e142c41
commit
fa361de0b7
3
tree.c
3
tree.c
@ -1860,7 +1860,7 @@ xmlNewPropInternal(xmlNodePtr node, xmlNsPtr ns,
|
||||
|
||||
if ((node != NULL) && (node->type != XML_ELEMENT_NODE)) {
|
||||
if ((eatname == 1) &&
|
||||
((node->doc == NULL) ||
|
||||
((node->doc == NULL) || (node->doc->dict == NULL) ||
|
||||
(!(xmlDictOwns(node->doc->dict, name)))))
|
||||
xmlFree((xmlChar *) name);
|
||||
return (NULL);
|
||||
@ -1873,6 +1873,7 @@ xmlNewPropInternal(xmlNodePtr node, xmlNsPtr ns,
|
||||
if (cur == NULL) {
|
||||
if ((eatname == 1) &&
|
||||
((node == NULL) || (node->doc == NULL) ||
|
||||
(node->doc->dict == NULL) ||
|
||||
(!(xmlDictOwns(node->doc->dict, name)))))
|
||||
xmlFree((xmlChar *) name);
|
||||
xmlTreeErrMemory("building attribute");
|
||||
|
Loading…
x
Reference in New Issue
Block a user