changeset 16821:844ed0418744

Remove two warnings, one compile-time, one runtime. Plug two leaks, both runtime.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 03 May 2007 17:43:07 +0000
parents fd620cbc5149
children 52c776782b95
files libpurple/buddyicon.c libpurple/status.c
diffstat 2 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/buddyicon.c	Thu May 03 16:50:31 2007 +0000
+++ b/libpurple/buddyicon.c	Thu May 03 17:43:07 2007 +0000
@@ -394,7 +394,6 @@
 
 		purple_buddy_set_icon(buddy, icon_to_set);
 
-
 		old_icon = g_strdup(purple_blist_node_get_string((PurpleBlistNode *)buddy,
 		                                                 "buddy_icon"));
 		if (icon->img && purple_buddy_icons_is_caching())
@@ -453,6 +452,7 @@
 			g_free(data);
 	}
 
+	g_free(icon->checksum);
 	icon->checksum = g_strdup(checksum);
 
 	purple_buddy_icon_update(icon);
@@ -523,7 +523,7 @@
 
 	if (icon != NULL)
 		purple_buddy_icon_set_data(icon, icon_data, icon_len, checksum);
-	else
+	else if (icon_data && icon_len > 0)
 	{
 		PurpleBuddyIcon *icon = purple_buddy_icon_new(account, username, icon_data, icon_len, checksum);
 		purple_buddy_icon_unref(icon);
@@ -616,11 +616,10 @@
 			{
 				const char *checksum;
 
-				if (icon == NULL)
-					icon = purple_buddy_icon_create(account, username);
+				icon = purple_buddy_icon_create(account, username);
 				icon->ref_count = 0;
 				icon->img = NULL;
-				checksum = g_strdup(purple_blist_node_get_string((PurpleBlistNode*)b, "icon_checksum"));
+				checksum = purple_blist_node_get_string((PurpleBlistNode*)b, "icon_checksum");
 				purple_buddy_icon_set_data(icon, data, len, checksum);
 			}
 			g_free(path);
--- a/libpurple/status.c	Thu May 03 16:50:31 2007 +0000
+++ b/libpurple/status.c	Thu May 03 17:43:07 2007 +0000
@@ -1311,7 +1311,6 @@
 
 	if (purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_BUDDY)
 	{
-		const GList *l;
 		time_t current_time = time(NULL);
 
 		update_buddy_idle(purple_presence_get_buddy(presence), presence, current_time,