Removing access to NULL pointers in node.c and element.c

Check that newNode is not NULL ixmlNode_cloneNodeTree and pass newAttr
as the return node in the ixmlElement_setAttributeNodeNS call of
ixmlElement_setAttributeNS.
This commit is contained in:
Fabrice Fontaine 2012-03-08 16:04:56 +01:00
parent 3ab8d536a0
commit 9b616a08df
3 changed files with 11 additions and 2 deletions

View File

@ -2,6 +2,14 @@
Version 1.6.16 Version 1.6.16
******************************************************************************* *******************************************************************************
2012-03-08 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
Removing access to NULL pointers in node.c and element.c
Check that newNode is not NULL ixmlNode_cloneNodeTree and pass newAttr
as the return node in the ixmlElement_setAttributeNodeNS call of
ixmlElement_setAttributeNS.
2012-03-08 Fabrice Fontaine <fabrice.fontaine(at)orange.com> 2012-03-08 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
Memory leaks correction in upnpapi.c Memory leaks correction in upnpapi.c

View File

@ -487,7 +487,7 @@ int ixmlElement_setAttributeNS(
Parser_freeNodeContent(&newAttrNode); Parser_freeNodeContent(&newAttrNode);
return IXML_INSUFFICIENT_MEMORY; return IXML_INSUFFICIENT_MEMORY;
} }
if (ixmlElement_setAttributeNodeNS(element, newAttr, NULL) != IXML_SUCCESS) { if (ixmlElement_setAttributeNodeNS(element, newAttr, &newAttr) != IXML_SUCCESS) {
ixmlAttr_free(newAttr); ixmlAttr_free(newAttr);
Parser_freeNodeContent(&newAttrNode); Parser_freeNodeContent(&newAttrNode);
return IXML_FAILED; return IXML_FAILED;

View File

@ -1040,7 +1040,8 @@ static IXML_Node *ixmlNode_cloneNodeTree(
} }
/* by spec, the duplicate node has no parent */ /* by spec, the duplicate node has no parent */
newNode->parentNode = NULL; if (newNode != NULL)
newNode->parentNode = NULL;
return newNode; return newNode;
} }