im.pidgin.pidgin: 78373ac0523b4bcf8530364077593f822030f45d

datallah at pidgin.im datallah at pidgin.im
Mon Oct 15 00:51:00 EDT 2007


-----------------------------------------------------------------
Revision: 78373ac0523b4bcf8530364077593f822030f45d
Ancestor: 23e3bb111a5b55d5bfab183bef2066946ddd73f3
Author: datallah at pidgin.im
Date: 2007-10-15T04:46:53
Branch: im.pidgin.pidgin

Modified files:
        libpurple/notify.c libpurple/notify.h

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/notify.c	fa61fe25aaa7a4a9d223feb37f1099c14d27e14b
+++ libpurple/notify.c	7114b0c8378cc5a0842800d9e27eed2ceb41fcc1
@@ -688,8 +688,11 @@ purple_notify_user_info_remove_last_item
 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 *
============================================================
--- libpurple/notify.h	318fb292c541c87e8f5b8ad0fd64f9972e1116cb
+++ libpurple/notify.h	341d2694108732fc10faa4d1019538ef43ec066d
@@ -539,7 +539,7 @@ void purple_notify_user_info_prepend_pai
 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


More information about the Commits mailing list