Mercurial > pidgin.yaz
changeset 15216:c65def04fb44
[gaim-migrate @ 18005]
Bug fix from Graham Booker. Fix an invalid pointer that resulted
from removing the last attribute of an xmlnode.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 15 Dec 2006 07:28:23 +0000 |
parents | 74511b8e9b46 |
children | ae58cf5a441f |
files | libgaim/xmlnode.c |
diffstat | 1 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/libgaim/xmlnode.c Fri Dec 15 07:00:32 2006 +0000 +++ b/libgaim/xmlnode.c Fri Dec 15 07:28:23 2006 +0000 @@ -127,14 +127,16 @@ for(attr_node = node->child; attr_node; attr_node = attr_node->next) { if(attr_node->type == XMLNODE_TYPE_ATTRIB && - !strcmp(attr_node->name, attr)) { + !strcmp(attr_node->name, attr)) + { if(node->child == attr_node) { node->child = attr_node->next; - } else if (node->lastchild == attr_node) { - node->lastchild = sibling; } else { sibling->next = attr_node->next; } + if (node->lastchild == attr_node) { + node->lastchild = sibling; + } xmlnode_free(attr_node); return; } @@ -155,14 +157,16 @@ { if(attr_node->type == XMLNODE_TYPE_ATTRIB && !strcmp(attr_node->name, attr) && - !strcmp(attr_node->xmlns, xmlns)) { + !strcmp(attr_node->xmlns, xmlns)) + { if(node->child == attr_node) { node->child = attr_node->next; - } else if (node->lastchild == attr_node) { - node->lastchild = sibling; } else { sibling->next = attr_node->next; } + if (node->lastchild == attr_node) { + node->lastchild = sibling; + } xmlnode_free(attr_node); return; } @@ -204,7 +208,7 @@ attrib_node->data = g_strdup(value); attrib_node->xmlns = g_strdup(xmlns); - xmlnode_insert_child(node, attrib_node); + xmlnode_insert_child(node, attrib_node); } const char * @@ -231,13 +235,13 @@ g_return_val_if_fail(node != NULL, NULL); for(x = node->child; x; x = x->next) { - if(x->type == XMLNODE_TYPE_ATTRIB && + if(x->type == XMLNODE_TYPE_ATTRIB && !strcmp(attr, x->name) && !strcmp(x->xmlns, xmlns)) { return x->data; } } - return NULL; + return NULL; }