changeset 23259:9c79e86e6f2b

Fix a memleak when handling jabber xforms. xmlnode_get_data() returns a string that needs to be freed. In most places we called value = xmlnode_get_data() a second time, so the first call wasn't used or needed.
author Mark Doliner <mark@kingant.net>
date Sun, 01 Jun 2008 20:05:06 +0000
parents babaa9794e1b
children 6c4db8059e91
files libpurple/protocols/jabber/xdata.c
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/xdata.c	Sun Jun 01 04:48:51 2008 +0000
+++ b/libpurple/protocols/jabber/xdata.c	Sun Jun 01 20:05:06 2008 +0000
@@ -232,10 +232,6 @@
 		if(!label)
 			label = var;
 
-		if((valuenode = xmlnode_get_child(fn, "value")))
-			value = xmlnode_get_data(valuenode);
-
-
 		if(!strcmp(type, "text-private")) {
 			if((valuenode = xmlnode_get_child(fn, "value")))
 				value = xmlnode_get_data(valuenode);
@@ -333,14 +329,16 @@
 			g_hash_table_replace(data->fields, g_strdup(var), GINT_TO_POINTER(JABBER_X_DATA_BOOLEAN));
 
 			g_free(value);
-		} else if(!strcmp(type, "fixed") && value) {
+		} else if(!strcmp(type, "fixed")) {
 			if((valuenode = xmlnode_get_child(fn, "value")))
 				value = xmlnode_get_data(valuenode);
 
-			field = purple_request_field_label_new("", value);
-			purple_request_field_group_add_field(group, field);
+			if(value != NULL) {
+				field = purple_request_field_label_new("", value);
+				purple_request_field_group_add_field(group, field);
 
-			g_free(value);
+				g_free(value);
+			}
 		} else if(!strcmp(type, "hidden")) {
 			if((valuenode = xmlnode_get_child(fn, "value")))
 				value = xmlnode_get_data(valuenode);