# HG changeset patch # User Richard Laager # Date 1150695570 0 # Node ID 571aebbe5ec6114898af673ded4b612868e6a2de # Parent d1fdde7cfc0ae3ba62a8acdfd5458b6a5437eb89 [gaim-migrate @ 16282] SF Patch #1502594 from Yosef Radchenko "Patches three instances of memory leaks with gaim_accounts_get_all_active" committer: Tailor Script diff -r d1fdde7cfc0a -r 571aebbe5ec6 plugins/idle.c --- a/plugins/idle.c Mon Jun 19 05:17:54 2006 +0000 +++ b/plugins/idle.c Mon Jun 19 05:39:30 2006 +0000 @@ -102,12 +102,13 @@ idle_all_action_ok(void *ignored, GaimRequestFields *fields) { GaimAccount *acct = NULL; - GList *l = gaim_accounts_get_all_active(); + GList *list, *iter; int tm = gaim_request_fields_get_integer(fields, "mins"); const char *prpl_id = NULL; - for(; l; l = l->next) { - acct = (GaimAccount *)(l->data); + list = gaim_accounts_get_all_active(); + for(iter = list; iter; iter = iter->next) { + acct = (GaimAccount *)(iter->data); if(acct) prpl_id = gaim_account_get_protocol_id(acct); @@ -122,6 +123,8 @@ idled_accts = g_list_append(idled_accts, acct); } } + + g_list_free(list); } static void diff -r d1fdde7cfc0a -r 571aebbe5ec6 plugins/perl/common/Account.xs --- a/plugins/perl/common/Account.xs Mon Jun 19 05:17:54 2006 +0000 +++ b/plugins/perl/common/Account.xs Mon Jun 19 05:39:30 2006 +0000 @@ -286,11 +286,13 @@ void gaim_accounts_get_all_active() PREINIT: - GList *l; + GList *list, *iter; PPCODE: - for (l = gaim_accounts_get_all_active(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(gaim_perl_bless_object(l->data, "Gaim::Account"))); + list = gaim_accounts_get_all_active(); + for (iter = gaim_accounts_get_all_active(); iter != NULL; iter = iter->next) { + XPUSHs(sv_2mortal(gaim_perl_bless_object(iter->data, "Gaim::Account"))); } + g_list_free(list); Gaim::Account gaim_accounts_find(name, protocol) diff -r d1fdde7cfc0a -r 571aebbe5ec6 src/gtkmain.c --- a/src/gtkmain.c Mon Jun 19 05:17:54 2006 +0000 +++ b/src/gtkmain.c Mon Jun 19 05:39:30 2006 +0000 @@ -432,6 +432,7 @@ char *opt_session_arg = NULL; int dologin_ret = -1; char *search_path; + GList *accounts; #ifdef HAVE_SIGNAL_H int sig_indx; /* for setting up signal catching */ sigset_t sigset; @@ -752,10 +753,14 @@ gaim_accounts_restore_current_statuses(); } - if (gaim_accounts_get_all_active() == NULL) + if ((accounts = gaim_accounts_get_all_active()) == NULL) { gaim_gtk_accounts_window_show(); } + else + { + g_list_free(accounts); + } #ifdef HAVE_STARTUP_NOTIFICATION startup_notification_complete();