diff libpurple/notify.c @ 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 04590d9db8b7
children 0cbfc19e4909
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 *