im.pidgin.pidgin.2.3.1: 54a1cdfd1a70da928835d2ca2d37d1519a291334

nosnilmot at pidgin.im nosnilmot at pidgin.im
Wed Dec 5 20:36:05 EST 2007


-----------------------------------------------------------------
Revision: 54a1cdfd1a70da928835d2ca2d37d1519a291334
Ancestor: 0229267a6b0bd1415dceb56ad0ce2d51d59541a9
Author: nosnilmot at pidgin.im
Date: 2007-12-06T01:19:19
Branch: im.pidgin.pidgin.2.3.1

Modified files:
        ChangeLog libpurple/plugins/perl/common/BuddyList.xs
        libpurple/plugins/perl/common/Cmds.xs
        libpurple/plugins/perl/common/Conversation.xs
        libpurple/plugins/perl/common/Log.xs
        libpurple/plugins/perl/common/Pounce.xs
        libpurple/plugins/perl/common/Prefs.xs
        libpurple/plugins/perl/common/Prpl.xs
        libpurple/plugins/perl/common/SavedStatuses.xs
        libpurple/plugins/perl/common/Status.xs

ChangeLog: 

applied changes from 8d953d5714cb202c5fa66fda1b0f31f01a969622
             through 2ffbc249cf14de9e738c76f8cdb0f55d32cdbf03

applied changes from 2ffbc249cf14de9e738c76f8cdb0f55d32cdbf03
             through 51648da970800504c5fef1552e7475982f977904

applied changes from 51648da970800504c5fef1552e7475982f977904
             through 93a8de710501e9a772b3fb12ab3db6682a41b3d6
Plug several leaks in perl plugins

-------------- next part --------------
============================================================
--- ChangeLog	f30f4ebd8913ecf0d74f4744b38a320824e486fb
+++ ChangeLog	049828e86206be7a4fb223a9ffc2e8ad6cec644f
@@ -19,6 +19,7 @@ version 2.3.1 (12/??/2007):
 	* Update QQ client version so we can connect again
 	* Do not allow ISON requests to stack in IRC, preventing flooding IRC
 	  servers when temporary network outages are restored
+	* Plug several leaks in the perl plugin loader
 
 
 version 2.3.0 (11/24/2007):
============================================================
--- libpurple/plugins/perl/common/BuddyList.xs	7ebfaff687bd987caf8bca1af40a03bbb2acbf06
+++ libpurple/plugins/perl/common/BuddyList.xs	8c35302f0b1916013aa8b3b54aaf66ceeb02c64b
@@ -44,11 +44,13 @@ PREINIT:
 	Purple::Account account
 	const char * name
 PREINIT:
-	GSList *l;
+	GSList *l, *ll;
 PPCODE:
-	for (l = purple_find_buddies(account, name); l != NULL; l = l->next) {
+	ll = purple_find_buddies(account, name);
+	for (l = ll; l != NULL; l = l->next) {
 		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::BuddyList::Buddy")));
 	}
+	g_slist_free(ll);
 
 Purple::BuddyList::Group
 purple_find_group(name)
@@ -101,11 +103,13 @@ PREINIT:
 purple_group_get_accounts(group)
 	Purple::BuddyList::Group  group
 PREINIT:
-	GSList *l;
+	GSList *l, *ll;
 PPCODE:
-	for (l = purple_group_get_accounts(group); l != NULL; l = l->next) {
+	ll = purple_group_get_accounts(group);
+	for (l = ll; l != NULL; l = l->next) {
 		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Account")));
 	}
+	g_slist_free(ll);
 
 gboolean
 purple_group_on_account(group, account)
@@ -268,11 +272,15 @@ PREINIT:
 purple_blist_node_get_extended_menu(node)
 	Purple::BuddyList::Node node
 PREINIT:
-	GList *l;
+	GList *l, *ll;
 PPCODE:
-	for (l = purple_blist_node_get_extended_menu(node); l != NULL; l = g_list_delete_link(l, l)) {
+	ll = purple_blist_node_get_extended_menu(node);
+	for (l = ll; l != NULL; l = l->next) {
 		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Menu::Action")));
 	}
+	/* We can free the list here but the script needs to free the
+	 * Purple::Menu::Action 'objects' itself. */
+	g_list_free(ll);
 
 void
 purple_blist_node_set_bool(node, key, value)
============================================================
--- libpurple/plugins/perl/common/Cmds.xs	8fbc1f1fa6a9ba79976d0aafbe2781b55c547d92
+++ libpurple/plugins/perl/common/Cmds.xs	eefa9fc9aa27801fff0a6368d289d991ae2000d5
@@ -66,21 +66,23 @@ PREINIT:
 	Purple::Conversation conv
 	const gchar *command
 PREINIT:
-	GList *l;
+	GList *l, *ll;
 PPCODE:
-	for (l = purple_cmd_help(conv, command); l != NULL; l = l->next) {
+	for (l = ll = purple_cmd_help(conv, command); l != NULL; l = l->next) {
 		XPUSHs(sv_2mortal(newSVpv(l->data, 0)));
 	}
+	g_list_free(ll);
 
 void
 purple_cmd_list(conv)
 	Purple::Conversation conv
 PREINIT:
-	GList *l;
+	GList *l, *ll;
 PPCODE:
-	for (l = purple_cmd_list(conv); l != NULL; l = l->next) {
+	for (l = ll = purple_cmd_list(conv); l != NULL; l = l->next) {
 		XPUSHs(sv_2mortal(newSVpv(l->data, 0)));
 	}
+	g_list_free(ll);
 
 Purple::Cmd::Id
 purple_cmd_register(plugin, command, args, priority, flag, prpl_id, func, helpstr, data = 0)
============================================================
--- libpurple/plugins/perl/common/Conversation.xs	3f378ab68ded04ed056f3d098d82cb3d3182cc65
+++ libpurple/plugins/perl/common/Conversation.xs	c02c9b0c797ce5cdc6bb877056ed0103de1e0411
@@ -464,6 +464,10 @@ PPCODE:
 
 	purple_conv_chat_add_users(chat, t_GL_users, t_GL_extra_msgs, t_GL_flags, new_arrivals);
 
+	g_list_free(t_GL_users);
+	g_list_free(t_GL_extra_msgs);
+	g_list_free(t_GL_flags);
+
 gboolean
 purple_conv_chat_find_user(chat, user)
 	Purple::Conversation::Chat chat
============================================================
--- libpurple/plugins/perl/common/Log.xs	e2ac791c4f078736333f93ba052eaf00123c0335
+++ libpurple/plugins/perl/common/Log.xs	aaa49ba972b17f30bf8c9137b81afc0c8aaf53f6
@@ -65,11 +65,15 @@ PREINIT:
 	const char *name
 	Purple::Account account
 PREINIT:
-	GList *l;
+	GList *l, *ll;
 PPCODE:
-	for (l = purple_log_get_logs(type, name, account); l != NULL; l = l->next) {
-		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry")));
+	ll = purple_log_get_logs(type, name, account);
+	for (l = ll; l != NULL; l = l->next) {
+		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Log")));
 	}
+	/* We can free the list here but the script needs to free the
+	 * Purple::Log 'objects' itself. */
+	g_list_free(ll);
 
 int
 purple_log_get_size(log)
@@ -79,11 +83,15 @@ PREINIT:
 purple_log_get_system_logs(account)
 	Purple::Account account
 PREINIT:
-	GList *l;
+	GList *l, *ll;
 PPCODE:
-	for (l = purple_log_get_system_logs(account); l != NULL; l = l->next) {
-		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry")));
+	ll = purple_log_get_system_logs(account);
+	for (l = ll; l != NULL; l = l->next) {
+		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Log")));
 	}
+	/* We can free the list here but the script needs to free the
+	 * Purple::Log 'objects' itself. */
+	g_list_free(ll);
 
 int
 purple_log_get_total_size(type, name, account)
@@ -101,11 +109,14 @@ PREINIT:
 void
 purple_log_logger_get_options()
 PREINIT:
-	GList *l;
+	GList *l, *ll;
 PPCODE:
-	for (l = purple_log_logger_get_options(); l != NULL; l = l->next) {
-		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry")));
+	/* This might want to be massaged to a hash, since that's essentially
+	 * what the key/value list is emulating. */
+	for (l = ll = purple_log_logger_get_options(); l != NULL; l = l->next) {
+		XPUSHs(sv_2mortal(newSVpv(l->data, 0)));
 	}
+	g_list_free(ll);
 
 gchar_own *
 purple_log_read(log, flags)
============================================================
--- libpurple/plugins/perl/common/Pounce.xs	52382751d475be8bd8318b4c755f5182f136c41e
+++ libpurple/plugins/perl/common/Pounce.xs	be86cf661f81767fa956a726c1a90b9b84ba5261
@@ -106,6 +106,18 @@ PPCODE:
 		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Pounce")));
 	}
 
+void
+purple_pounces_get_all_for_ui(ui)
+	const char *ui
+PREINIT:
+	GList *l, *ll;
+PPCODE:
+	ll = purple_pounces_get_all_for_ui(ui);
+	for (l = ll; l != NULL; l = l->next) {
+		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Pounce")));
+	}
+	g_list_free(ll);
+
 Purple::Handle
 purple_pounces_get_handle()
 
============================================================
--- libpurple/plugins/perl/common/Prefs.xs	2bdd40e87fc760b68f158c1ede17a9a68424cffb
+++ libpurple/plugins/perl/common/Prefs.xs	7f722e7af78d715135e5cc6507b535b228dbada6
@@ -57,6 +57,7 @@ PPCODE:
 		t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(value), i, 0), t_sl));
 	}
 	purple_prefs_add_string_list(name, t_GL);
+	g_list_free(t_GL);
 
 void
 purple_prefs_destroy()
@@ -159,6 +160,7 @@ PPCODE:
 		t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(value), i, 0), t_sl));
 	}
 	purple_prefs_set_string_list(name, t_GL);
+	g_list_free(t_GL);
 
 void
 purple_prefs_trigger_callback(name)
============================================================
--- libpurple/plugins/perl/common/Prpl.xs	694d071a8a11c788161e66294cd62f4c32e2cb70
+++ libpurple/plugins/perl/common/Prpl.xs	a6518808a5f1de59396ee912f738b225626ed617
@@ -21,13 +21,15 @@ PREINIT:
 	Purple::Account account
 	Purple::Presence presence
 PREINIT:
-	GList *l;
+	GList *l, *ll;
 PPCODE:
-	for (l = purple_prpl_get_statuses(account,presence); l != NULL; l = l->next) {
-		/* XXX Someone please test and make sure this is the right
-		 * type for these things. */
+	ll = purple_prpl_get_statuses(account,presence);
+	for (l = ll; l != NULL; l = l->next) {
 		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Status")));
 	}
+	/* We can free the list here but the script needs to free the
+	 * Purple::Status 'objects' itself. */
+	g_list_free(ll);
 
 void
 purple_prpl_got_account_idle(account, idle, idle_time)
============================================================
--- libpurple/plugins/perl/common/SavedStatuses.xs	5e6efe2c0ac1d3414d9bf3209240c0109877a59a
+++ libpurple/plugins/perl/common/SavedStatuses.xs	baf69bfabf99913a2f891267acf96af435bdf413
@@ -140,11 +140,13 @@ PREINIT:
 purple_savedstatuses_get_popular(how_many)
 	unsigned int how_many
 PREINIT:
-	GList *l;
+	GList *l, *ll;
 PPCODE:
-	for (l = purple_savedstatuses_get_popular(how_many); l != NULL; l = l->next) {
+	ll = purple_savedstatuses_get_popular(how_many);
+	for (l = ll; l != NULL; l = l->next) {
 		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::SavedStatus")));
 	}
+	g_list_free(ll);
 
 Purple::Handle
 purple_savedstatuses_get_handle()
============================================================
--- libpurple/plugins/perl/common/Status.xs	66ecc30db8b9695247cfaba0e1eadf426234657f
+++ libpurple/plugins/perl/common/Status.xs	e82b21edc6bb1c5f1b5955b4fb1d2a9a363f9d71
@@ -90,6 +90,7 @@ PPCODE:
 		t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(source_list), i, 0), t_sl));
 	}
 	purple_presence_add_list(presence, t_GL);
+	g_list_free(t_GL);
 
 void
 purple_presence_add_status(presence, status)
@@ -361,14 +362,26 @@ purple_status_type_destroy(status_type)
 purple_status_type_destroy(status_type)
 	Purple::StatusType status_type
 
+Purple::StatusAttr
+purple_status_type_get_attr(status_type, id)
+	Purple::StatusType status_type
+	const char *id
+
+void
+purple_status_type_get_attrs(status_type)
+	Purple::StatusType status_type
+PREINIT:
+	GList *l;
+PPCODE:
+	for (l = purple_status_type_get_attrs(status_type); l != NULL; l = l->next) {
+		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::StatusAttr")));
+	}
+
 Purple::StatusType
 purple_status_type_find_with_id(status_types, id)
 	SV *status_types
 	const char *id
 PREINIT:
-/* XXX Check that this function actually works, I think it might need a */
-/* status_type as it's first argument to work as $status_type->find_with_id */
-/* properly. */
 	GList *t_GL;
 	int i, t_len;
 CODE:
@@ -380,24 +393,10 @@ CODE:
 		t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(status_types), i, 0), t_sl));
 	}
 	RETVAL = (PurpleStatusType *)purple_status_type_find_with_id(t_GL, id);
+	g_list_free(t_GL);
 OUTPUT:
 	RETVAL
 
-Purple::StatusAttr
-purple_status_type_get_attr(status_type, id)
-	Purple::StatusType status_type
-	const char *id
-
-void
-purple_status_type_get_attrs(status_type)
-	Purple::StatusType status_type
-PREINIT:
-	GList *l;
-PPCODE:
-	for (l = purple_status_type_get_attrs(status_type); l != NULL; l = l->next) {
-		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::StatusAttr")));
-	}
-
 const char *
 purple_status_type_get_id(status_type)
 	Purple::StatusType status_type


More information about the Commits mailing list