Mercurial > pidgin
changeset 21775:4dc66862203f
This should plug some leaks related to not having freed GList:s and GSList:s
returned from some libpurple functions.
author | Etan Reisner <pidgin@unreliablesource.net> |
---|---|
date | Sat, 01 Dec 2007 06:30:25 +0000 |
parents | b63b2a5c2d05 |
children | 4b33d4185342 |
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 |
diffstat | 5 files changed, 28 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/plugins/perl/common/Cmds.xs Sat Dec 01 03:41:37 2007 +0000 +++ b/libpurple/plugins/perl/common/Cmds.xs Sat Dec 01 06:30:25 2007 +0000 @@ -66,21 +66,23 @@ 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)
--- a/libpurple/plugins/perl/common/Conversation.xs Sat Dec 01 03:41:37 2007 +0000 +++ b/libpurple/plugins/perl/common/Conversation.xs Sat Dec 01 06:30:25 2007 +0000 @@ -464,6 +464,10 @@ 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
--- a/libpurple/plugins/perl/common/Pounce.xs Sat Dec 01 03:41:37 2007 +0000 +++ b/libpurple/plugins/perl/common/Pounce.xs Sat Dec 01 06:30:25 2007 +0000 @@ -106,6 +106,18 @@ 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()
--- a/libpurple/plugins/perl/common/Prefs.xs Sat Dec 01 03:41:37 2007 +0000 +++ b/libpurple/plugins/perl/common/Prefs.xs Sat Dec 01 06:30:25 2007 +0000 @@ -57,6 +57,7 @@ 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 @@ 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)
--- a/libpurple/plugins/perl/common/SavedStatuses.xs Sat Dec 01 03:41:37 2007 +0000 +++ b/libpurple/plugins/perl/common/SavedStatuses.xs Sat Dec 01 06:30:25 2007 +0000 @@ -140,11 +140,13 @@ 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()