diff --git a/ChangeLog b/ChangeLog index d9922f0..c9529e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -299,6 +299,16 @@ Version 1.8.0 Version 1.6.16 ******************************************************************************* +2012-02-29 Fabrice Fontaine + + SF Bug Tracker id 3495616 - Memory leak in ixmlElement_setAttributeNS + + Submitted: Fabrice Fontaine ( ffontaine ) - 2012-02-29 02:09:43 PST + + newAttrNode is not freed if newAttr->n.nodeValue = strdup(value); returns + NULL or if ixmlElement_setAttributeNodeNS(element, newAttr, NULL) does + not return IXML_SUCCESS. + 2012-02-28 Fabrice Fontaine SF Bug Tracker id 3495286 - Double free in get_action_node diff --git a/ixml/src/element.c b/ixml/src/element.c index 1f59c9e..2b2296b 100644 --- a/ixml/src/element.c +++ b/ixml/src/element.c @@ -2,6 +2,7 @@ * * Copyright (c) 2000-2003 Intel Corporation * All rights reserved. + * Copyright (c) 2012 France Telecom All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -492,15 +493,18 @@ int ixmlElement_setAttributeNS( qualifiedName, &newAttr); if (rc != IXML_SUCCESS) { + Parser_freeNodeContent(&newAttrNode); return rc; } newAttr->n.nodeValue = strdup(value); if (newAttr->n.nodeValue == NULL) { ixmlAttr_free(newAttr); + Parser_freeNodeContent(&newAttrNode); return IXML_INSUFFICIENT_MEMORY; } if (ixmlElement_setAttributeNodeNS(element, newAttr, NULL) != IXML_SUCCESS) { ixmlAttr_free(newAttr); + Parser_freeNodeContent(&newAttrNode); return IXML_FAILED; } }