changeset 17742:ee58212687bb

Plug a few more memory leaks for some perl plugins.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 22 May 2007 11:01:14 +0000
parents b61baeefbe38
children 3c3b0b89b87a
files libpurple/plugins/perl/common/Account.xs libpurple/plugins/perl/common/BuddyList.xs libpurple/plugins/perl/common/Prefs.xs
diffstat 3 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/perl/common/Account.xs	Tue May 22 10:09:50 2007 +0000
+++ b/libpurple/plugins/perl/common/Account.xs	Tue May 22 11:01:14 2007 +0000
@@ -215,6 +215,7 @@
         t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(list), i, 0), t_sl));
     }
     purple_account_add_buddies(account, t_GL);
+    g_list_free(t_GL);
 
 void
 purple_account_add_buddy(account, buddy)
@@ -252,6 +253,8 @@
         t_GL2 = g_list_append(t_GL2, SvPV(*av_fetch((AV *)SvRV(B), i, 0), t_sl));
     }
     purple_account_remove_buddies(account, t_GL1, t_GL2);
+    g_list_free(t_GL1);
+    g_list_free(t_GL2);
 
 void
 purple_account_remove_buddy(account, buddy, group)
--- a/libpurple/plugins/perl/common/BuddyList.xs	Tue May 22 10:09:50 2007 +0000
+++ b/libpurple/plugins/perl/common/BuddyList.xs	Tue May 22 11:01:14 2007 +0000
@@ -263,7 +263,7 @@
 PREINIT:
 	GList *l;
 PPCODE:
-	for (l = purple_blist_node_get_extended_menu(node); l != NULL; l = l->next) {
+	for (l = purple_blist_node_get_extended_menu(node); l != NULL; l = g_list_delete_link(l, l)) {
 		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Menu::Action")));
 	}
 
--- a/libpurple/plugins/perl/common/Prefs.xs	Tue May 22 10:09:50 2007 +0000
+++ b/libpurple/plugins/perl/common/Prefs.xs	Tue May 22 11:01:14 2007 +0000
@@ -94,8 +94,9 @@
 PREINIT:
 	GList *l;
 PPCODE:
-	for (l = purple_prefs_get_string_list(name); l != NULL; l = l->next) {
+	for (l = purple_prefs_get_string_list(name); l != NULL; l = g_list_delete_link(l, l)) {
 		XPUSHs(sv_2mortal(newSVpv(l->data, 0)));
+		g_free(l->data);
 	}
 
 Purple::PrefType