changeset 28162:44930be7114b

Fix two memory leaks. We were setting norm_bud and temp to NULL without freeing them first. I'm guessing this wasn't severe, but I didn't really look at what this code does.
author Mark Doliner <mark@kingant.net>
date Tue, 04 Aug 2009 08:14:41 +0000
parents 79630bfee621
children 90b471ba5282
files libpurple/protocols/yahoo/libymsg.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/libymsg.c	Tue Aug 04 04:19:34 2009 +0000
+++ b/libpurple/protocols/yahoo/libymsg.c	Tue Aug 04 08:14:41 2009 +0000
@@ -478,7 +478,7 @@
 	PurpleAccount *account = purple_connection_get_account(gc);
 	YahooData *yd = gc->proto_data;
 	GHashTable *ht;
-	char *norm_bud = NULL;
+	char *norm_bud;
 	char *temp = NULL;
 	YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */
 	                       /* But what if you had no friends? */
@@ -487,7 +487,6 @@
 	int protocol = 0;
 	int stealth = 0;
 
-
 	ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free);
 
 	while (l) {
@@ -546,9 +545,11 @@
 					purple_privacy_deny_add(account, norm_bud, 1);
 				}
 
+				g_free(norm_bud);
+
 				protocol = 0;
 				stealth = 0;
-				norm_bud = NULL;
+				g_free(temp);
 				temp = NULL;
 			}
 			break;
@@ -559,6 +560,7 @@
 			yd->current_list15_grp = yahoo_string_decode(gc, pair->value, FALSE);
 			break;
 		case 7: /* buddy's s/n */
+			g_free(temp);
 			temp = g_strdup(purple_normalize(account, pair->value));
 			break;
 		case 241: /* another protocol user */
@@ -594,7 +596,6 @@
 	yahoo_set_status(account, purple_account_get_active_status(account));
 
 	g_hash_table_destroy(ht);
-	g_free(norm_bud);
 	g_free(temp);
 }