changeset 16065:0db4eca4a3e0

I noticed some places where we were doing the whole "if (!NULL) then free()" thing.
author Mark Doliner <mark@kingant.net>
date Wed, 11 Apr 2007 15:45:48 +0000
parents 5106ccf9f9f1
children ce85859d2f41
files libpurple/protocols/jabber/xdata.c
diffstat 1 files changed, 7 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/xdata.c	Wed Apr 11 15:21:47 2007 +0000
+++ b/libpurple/protocols/jabber/xdata.c	Wed Apr 11 15:45:48 2007 +0000
@@ -200,8 +200,7 @@
 
 			g_hash_table_replace(data->fields, g_strdup(var), GINT_TO_POINTER(JABBER_X_DATA_TEXT_SINGLE));
 
-			if(value)
-				g_free(value);
+			g_free(value);
 		} else if(!strcmp(type, "text-multi") || !strcmp(type, "jid-multi")) {
 			GString *str = g_string_new("");
 
@@ -283,8 +282,7 @@
 
 			g_hash_table_replace(data->fields, g_strdup(var), GINT_TO_POINTER(JABBER_X_DATA_BOOLEAN));
 
-			if(value)
-				g_free(value);
+			g_free(value);
 		} else if(!strcmp(type, "fixed") && value) {
 			if((valuenode = xmlnode_get_child(fn, "value")))
 				value = xmlnode_get_data(valuenode);
@@ -292,8 +290,7 @@
 			field = purple_request_field_label_new("", value);
 			purple_request_field_group_add_field(group, field);
 
-			if(value)
-				g_free(value);
+			g_free(value);
 		} else if(!strcmp(type, "hidden")) {
 			if((valuenode = xmlnode_get_child(fn, "value")))
 				value = xmlnode_get_data(valuenode);
@@ -305,8 +302,7 @@
 
 			g_hash_table_replace(data->fields, g_strdup(var), GINT_TO_POINTER(JABBER_X_DATA_TEXT_SINGLE));
 
-			if(value)
-				g_free(value);
+			g_free(value);
 		} else { /* text-single, jid-single, and the default */
 			if((valuenode = xmlnode_get_child(fn, "value")))
 				value = xmlnode_get_data(valuenode);
@@ -322,8 +318,7 @@
 				g_hash_table_replace(data->fields, g_strdup(var), GINT_TO_POINTER(JABBER_X_DATA_TEXT_SINGLE));
 			}
 
-			if(value)
-				g_free(value);
+			g_free(value);
 		}
 	}
 
@@ -337,10 +332,8 @@
 			_("OK"), G_CALLBACK(jabber_x_data_ok_cb),
 			_("Cancel"), G_CALLBACK(jabber_x_data_cancel_cb), data);
 
-	if(title)
-		g_free(title);
-	if(instructions)
-		g_free(instructions);
+	g_free(title);
+	g_free(instructions);
 
 	return handle;
 }