Mercurial > pidgin.yaz
diff libpurple/protocols/myspace/myspace.c @ 24853:c6cadb7bdcf7
A couple of memory leak fixes.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Thu, 01 Jan 2009 03:12:56 +0000 |
parents | 22fd7467f0cc |
children | 1981b04de92e cead8692e35f ae544623840b c0b42d6c2785 f0c2e27c7ae7 |
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c Thu Jan 01 01:04:34 2009 +0000 +++ b/libpurple/protocols/myspace/myspace.c Thu Jan 01 03:12:56 2009 +0000 @@ -211,7 +211,6 @@ /* Don't have uid offhand - need to ask for it, and wait until hear back before sending. */ purple_debug_info("msim", ">>> msim_postprocess_outgoing: couldn't find username %s in blist\n", username ? username : "(NULL)"); - /* TODO: where is cloned message freed? Should be in _cb. */ msim_lookup_user(session, username, msim_postprocess_outgoing_cb, msim_msg_clone(msg)); return TRUE; /* not sure of status yet - haven't sent! */ } @@ -1923,8 +1922,7 @@ msim_process(session, msg); - /* TODO: Free copy cloned from msim_preprocess_incoming(). */ - /* msim_msg_free(msg); */ + msim_msg_free(msg); msim_msg_free(body); } @@ -2731,9 +2729,15 @@ * doesn't seem like it would be necessary, but the official client * does it) */ - if (!msim_update_blocklist_for_buddy(session, buddy->name, FALSE, FALSE)) + if (!msim_update_blocklist_for_buddy(session, buddy->name, FALSE, FALSE)) { purple_notify_error(NULL, NULL, _("Failed to remove buddy"), _("blocklist command failed")); + return; + } + if (buddy->proto_data) { + msim_user_free(buddy->proto_data); + buddy->proto_data = NULL; + } } /** @@ -2823,6 +2827,13 @@ msim_update_blocklist_for_buddy(session, name, FALSE, FALSE); } +static void +msim_buddy_free(PurpleBuddy *buddy) +{ + msim_user_free(buddy->proto_data); + buddy->proto_data = NULL; +} + /** * Returns a string of a username in canonical form. Basically removes all the * spaces, lowercases the string, and looks up user IDs to usernames. @@ -3039,7 +3050,7 @@ NULL, /* alias_buddy */ NULL, /* group_buddy */ NULL, /* rename_group */ - NULL, /* buddy_free */ + msim_buddy_free, /* buddy_free */ NULL, /* convo_closed */ msim_normalize, /* normalize */ NULL, /* set_buddy_icon */