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.
(cherry picked from commit 9b616a08df3613bf27473d176b1b72cd671b75a5)
This commit is contained in:
Fabrice Fontaine 2012-03-08 16:04:56 +01:00 committed by Marcelo Roberto Jimenez
parent 10805cb8cc
commit 63cccfff08
3 changed files with 11 additions and 2 deletions

View File

@ -318,6 +318,14 @@ Version 1.8.0
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>
Memory leaks correction in upnpapi.c

View File

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

View File

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