pidgin: 46f6d47a: Make sure we free myspace buddy proto_da...
Mark Doliner
mark at kingant.net
Thu Feb 4 21:37:33 EST 2010
On Thu, Feb 4, 2010 at 6:31 PM, Paul Aurich <paul at darkrain42.org> wrote:
> On Feb 4, 2010, at 14:45, markdoliner at pidgin.im wrote:
>> ChangeLog:
>>
>> 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
>>
>> ============================================================
>> --- libpurple/protocols/myspace/myspace.c ec7093319f8188f3a234ea37d53ee67ec7d214b5
>> +++ libpurple/protocols/myspace/myspace.c 24dfb0496390d036c339df25aa402469a76051b3
>
> <snip/>
>
>> @@ -2272,8 +2279,20 @@ msim_close(PurpleConnection *gc)
>> 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);
>> + }
>> +
>
> Isn't this going to fail catastrophically if a libpurple instance has more than one account signed on? (purple_blist_get_buddies is every buddy on the buddy list). Wouldn't purple_find_buddies(purple_connection_get_account(gc), NULL) be more appropriate?
Yes! I just noticed that. And I'd forgotten that
purple_find_buddies() could be used that way. I'll fix that.
Thanks!
--Mark
More information about the Devel
mailing list