From: <rl...@us...> - 2006-06-19 05:39:35
|
Revision: 16282 Author: rlaager Date: 2006-06-18 22:39:30 -0700 (Sun, 18 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16282&view=rev Log Message: ----------- SF Patch #1502594 from Yosef Radchenko "Patches three instances of memory leaks with gaim_accounts_get_all_active" Modified Paths: -------------- trunk/plugins/idle.c trunk/plugins/perl/common/Account.xs trunk/src/gtkmain.c Modified: trunk/plugins/idle.c =================================================================== --- trunk/plugins/idle.c 2006-06-19 05:17:54 UTC (rev 16281) +++ trunk/plugins/idle.c 2006-06-19 05:39:30 UTC (rev 16282) @@ -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 Modified: trunk/plugins/perl/common/Account.xs =================================================================== --- trunk/plugins/perl/common/Account.xs 2006-06-19 05:17:54 UTC (rev 16281) +++ trunk/plugins/perl/common/Account.xs 2006-06-19 05:39:30 UTC (rev 16282) @@ -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) Modified: trunk/src/gtkmain.c =================================================================== --- trunk/src/gtkmain.c 2006-06-19 05:17:54 UTC (rev 16281) +++ trunk/src/gtkmain.c 2006-06-19 05:39:30 UTC (rev 16282) @@ -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(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |