# HG changeset patch # User Mark Doliner # Date 1265323262 0 # Node ID 52fffd4cdd6230f958bb82583f31bb37924e6c90 # Parent 86f5173195cd68ec337faf83da89dabfe1195e2d Make sure we free myspace buddy proto_data when we disconnect. I believe this fixes a memory leak and a crash when signing off while we're fetching a buddy icon diff -r 86f5173195cd -r 52fffd4cdd62 libpurple/protocols/myspace/myspace.c --- a/libpurple/protocols/myspace/myspace.c Thu Feb 04 22:37:21 2010 +0000 +++ b/libpurple/protocols/myspace/myspace.c Thu Feb 04 22:41:02 2010 +0000 @@ -2264,6 +2264,13 @@ } } +static void +msim_buddy_free(PurpleBuddy *buddy) +{ + msim_user_free(purple_buddy_get_protocol_data(buddy)); + purple_buddy_set_protocol_data(buddy, NULL); +} + /** * Close the connection. * @@ -2272,8 +2279,20 @@ static void msim_close(PurpleConnection *gc) { + GSList *buddies; MsimSession *session; + /* + * Free our protocol-specific buddy data. It almost seems like libpurple + * should call our buddy_free prpl callback so that we don't need to do + * this... but it doesn't, so we do. + */ + buddies = purple_blist_get_buddies(); + while (buddies != NULL) { + msim_buddy_free(buddies->data); + buddies = g_slist_delete_link(buddies, buddies); + } + if (gc == NULL) { return; } @@ -2734,13 +2753,6 @@ msim_update_blocklist_for_buddy(session, name, TRUE, FALSE); } -static void -msim_buddy_free(PurpleBuddy *buddy) -{ - msim_user_free(purple_buddy_get_protocol_data(buddy)); - purple_buddy_set_protocol_data(buddy, NULL); -} - /** * Remove a buddy from the user's buddy list. */