Commit 4855c8c3 authored by Daniel Veillard's avatar Daniel Veillard
Browse files

fixed a couple of problems in xmlSetProp() Daniel

* tree.c: fixed a couple of problems in xmlSetProp()
Daniel
parent cd337f0b
Sun Nov 25 11:34:24 CET 2001 Daniel Veillard <daniel@veillard.com>
* tree.c: fixed a couple of problems in xmlSetProp()
Thu Nov 22 19:19:10 CET 2001 Daniel Veillard <daniel@veillard.com>
* debugXML.c tree.c xmlIO.c xmlmemory.c: some cleanups when chasing
......
......@@ -4485,17 +4485,18 @@ xmlGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
*/
xmlAttrPtr
xmlSetProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value) {
xmlAttrPtr prop = node->properties;
xmlDocPtr doc = NULL;
xmlAttrPtr prop;
xmlDocPtr doc;
if ((node == NULL) || (name == NULL))
return(NULL);
doc = node->doc;
prop = node->properties;
while (prop != NULL) {
if ((xmlStrEqual(prop->name, name)) &&
(prop->ns == NULL)){
if (prop->children != NULL)
xmlFreeNodeList(prop->children);
xmlNodePtr oldprop = prop->children;
prop->children = NULL;
prop->last = NULL;
if (value != NULL) {
......@@ -4516,6 +4517,8 @@ xmlSetProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value) {
}
xmlFree(buffer);
}
if (oldprop != NULL)
xmlFreeNodeList(oldprop);
return(prop);
}
prop = prop->next;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment