Mercurial > pidgin.yaz
changeset 20949:dd0878ccc577
Clarify the documentation for purple_notify_user_info_remove_entry() to indicated that it doesn't free the removed entry. Make purple_notify_user_info_remove_last_item() free the entry it is removing as that is the only sensible thing to do (otherwise purple_notify_user_info_remove_entry() should have been used instead). This fixes leakage in the msn prpl.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Mon, 15 Oct 2007 04:46:53 +0000 |
parents | 128aca651b9a |
children | 52deb2160496 |
files | libpurple/notify.c libpurple/notify.h |
diffstat | 2 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/notify.c Mon Oct 15 04:42:44 2007 +0000 +++ b/libpurple/notify.c Mon Oct 15 04:46:53 2007 +0000 @@ -688,8 +688,11 @@ void purple_notify_user_info_remove_last_item(PurpleNotifyUserInfo *user_info) { - user_info->user_info_entries = g_list_remove(user_info->user_info_entries, - g_list_last(user_info->user_info_entries)->data); + GList *last = g_list_last(user_info->user_info_entries); + if (last) { + purple_notify_user_info_entry_destroy(last->data); + user_info->user_info_entries = g_list_remove_link(user_info->user_info_entries, last); + } } void *
--- a/libpurple/notify.h Mon Oct 15 04:42:44 2007 +0000 +++ b/libpurple/notify.h Mon Oct 15 04:46:53 2007 +0000 @@ -539,7 +539,7 @@ void purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value); /** - * Remove a PurpleNotifyUserInfoEntry from a PurpleNotifyUserInfo object + * Remove a PurpleNotifyUserInfoEntry from a PurpleNotifyUserInfo object without freeing the entry. * * @param user_info The PurpleNotifyUserInfo * @param user_info_entry The PurpleNotifyUserInfoEntry