im.pidgin.pidgin: 2ffbc249cf14de9e738c76f8cdb0f55d32cdbf03

deryni at pidgin.im deryni at pidgin.im
Tue Dec 4 19:22:41 EST 2007


-----------------------------------------------------------------
Revision: 2ffbc249cf14de9e738c76f8cdb0f55d32cdbf03
Ancestor: 8d953d5714cb202c5fa66fda1b0f31f01a969622
Author: deryni at pidgin.im
Date: 2007-12-01T06:30:25
Branch: im.pidgin.pidgin

Modified files:
        libpurple/plugins/perl/common/Cmds.xs
        libpurple/plugins/perl/common/Conversation.xs
        libpurple/plugins/perl/common/Pounce.xs
        libpurple/plugins/perl/common/Prefs.xs
        libpurple/plugins/perl/common/SavedStatuses.xs

ChangeLog: 

This should plug some leaks related to not having freed GList:s and GSList:s
returned from some libpurple functions.

-------------- next part --------------
============================================================
--- 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/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/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()


More information about the Commits mailing list