pidgin: aa8467c5: Fix two memory leaks. We were setting n...

markdoliner at pidgin.im markdoliner at pidgin.im
Tue Aug 4 04:21:30 EDT 2009


-----------------------------------------------------------------
Revision: aa8467c55080364b3e303ee0376d4f4587c453ce
Ancestor: 7e0963939e06903e78ffae5f699f302ac3f4f7db
Author: markdoliner at pidgin.im
Date: 2009-08-04T08:14:41
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/aa8467c55080364b3e303ee0376d4f4587c453ce

Modified files:
        libpurple/protocols/yahoo/libymsg.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/libymsg.c	9022ac959f817e6065cd41377b6c84e524ba41af
+++ libpurple/protocols/yahoo/libymsg.c	eaf6b4b92109907bc13fe78916c3d9bcdb24d27d
@@ -478,7 +478,7 @@ static void yahoo_process_list_15(Purple
 	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 @@ static void yahoo_process_list_15(Purple
 	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 @@ static void yahoo_process_list_15(Purple
 					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 @@ static void yahoo_process_list_15(Purple
 			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 @@ static void yahoo_process_list_15(Purple
 	yahoo_set_status(account, purple_account_get_active_status(account));
 
 	g_hash_table_destroy(ht);
-	g_free(norm_bud);
 	g_free(temp);
 }
 


More information about the Commits mailing list