diff options
author | Hiroyuki Ikezoe <poincare@ikezoe.net> | 2007-07-26 20:37:57 +0800 |
---|---|---|
committer | Hiroyuki Ikezoe <hiikezoe@src.gnome.org> | 2007-07-26 20:37:57 +0800 |
commit | 7193b99f7ae278d58bc06c0322d8c12eddaf2df6 (patch) | |
tree | fc69a4b1a5d3b18a4707c6c775983d490399d42b | |
parent | 0aa26a1e49d1595f0e250982dd3e13f82323efbc (diff) | |
download | gsoc2013-evolution-7193b99f7ae278d58bc06c0322d8c12eddaf2df6.tar.gz gsoc2013-evolution-7193b99f7ae278d58bc06c0322d8c12eddaf2df6.tar.zst gsoc2013-evolution-7193b99f7ae278d58bc06c0322d8c12eddaf2df6.zip |
Plugged memory leaks.
2007-07-26 Hiroyuki Ikezoe <poincare@ikezoe.net>
* gui/alarm-notify/config-data.c, gui/tasks-component.c,
gui/calendar-component.c, gui/memos-component.c: Plugged memory leaks.
svn path=/trunk/; revision=33852
-rw-r--r-- | calendar/ChangeLog | 5 | ||||
-rw-r--r-- | calendar/gui/alarm-notify/config-data.c | 21 | ||||
-rw-r--r-- | calendar/gui/calendar-component.c | 14 | ||||
-rw-r--r-- | calendar/gui/memos-component.c | 10 | ||||
-rw-r--r-- | calendar/gui/tasks-component.c | 10 |
5 files changed, 55 insertions, 5 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 7927f63e94..0b460de7a2 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,8 @@ +2007-07-26 Hiroyuki Ikezoe <poincare@ikezoe.net> + + * gui/alarm-notify/config-data.c, gui/tasks-component.c, + gui/calendar-component.c, gui/memos-component.c: Plugged memory leaks. + 2007-07-26 Milan Crha <mcrha@redhat.com> ** Fix for bug #273699 diff --git a/calendar/gui/alarm-notify/config-data.c b/calendar/gui/alarm-notify/config-data.c index 28b3730e9e..9ddac9f3c1 100644 --- a/calendar/gui/alarm-notify/config-data.c +++ b/calendar/gui/alarm-notify/config-data.c @@ -111,8 +111,11 @@ config_data_get_calendars (const char *key) NULL); cal_sources = e_source_list_new_for_gconf (conf_client, key); - if (cal_sources && g_slist_length (gconf_list)) + if (cal_sources && g_slist_length (gconf_list)) { + g_slist_foreach (gconf_list, (GFunc) g_free, NULL); + g_slist_free (gconf_list); return cal_sources; + } state = gconf_client_get_bool (conf_client, "/apps/evolution/calendar/notify/notify_with_tray", @@ -133,8 +136,17 @@ config_data_get_calendars (const char *key) source, NULL); cal_sources = e_source_list_new_for_gconf (conf_client, key); + + if (source) { + g_slist_foreach (source, (GFunc) g_free, NULL); + g_slist_free (source); + } + } + + if (gconf_list) { + g_slist_foreach (gconf_list, (GFunc) g_free, NULL); + g_slist_free (gconf_list); } - return cal_sources; @@ -171,6 +183,11 @@ config_data_replace_string_list (const char *key, break; } } + + if (source) { + g_slist_foreach (source, (GFunc) g_free, NULL); + g_slist_free (source); + } } GConfClient * diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index f077199fa6..38bd178156 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -241,12 +241,14 @@ ensure_sources (CalendarComponent *component) if (!personal_source) { char *primary_calendar = calendar_config_get_primary_calendar(); + GSList *calendars_selected; /* Create the default Person addressbook */ personal_source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI); e_source_group_add_source (on_this_computer, personal_source, -1); - if (!primary_calendar && !calendar_config_get_calendars_selected ()) { + calendars_selected = calendar_config_get_calendars_selected (); + if (!primary_calendar && !calendars_selected) { GSList selected; calendar_config_set_primary_calendar (e_source_peek_uid (personal_source)); @@ -256,6 +258,11 @@ ensure_sources (CalendarComponent *component) calendar_config_set_calendars_selected (&selected); } + if (calendars_selected) { + g_slist_foreach (calendars_selected, (GFunc) g_free, NULL); + g_slist_free (calendars_selected); + } + g_free (primary_calendar); e_source_set_color_spec (personal_source, "#BECEDD"); } @@ -465,6 +472,11 @@ update_task_memo_selection (CalendarComponentView *component_view, ECalSourceTyp component_view->task_source_selection = uids_selected; else component_view->memo_source_selection = uids_selected; + + if (uids_selected) { + g_slist_foreach (uids_selected, (GFunc) g_free, NULL); + g_slist_free (uids_selected); + } } static void diff --git a/calendar/gui/memos-component.c b/calendar/gui/memos-component.c index e2ece2d215..40bb509494 100644 --- a/calendar/gui/memos-component.c +++ b/calendar/gui/memos-component.c @@ -204,11 +204,14 @@ ensure_sources (MemosComponent *component) } if (!personal_source) { + GSList *memos_selected; /* Create the default Person addressbook */ ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI); e_source_group_add_source (on_this_computer, source, -1); - if (!calendar_config_get_primary_memos () && !calendar_config_get_memos_selected ()) { + memos_selected = calendar_config_get_memos_selected (); + + if (!calendar_config_get_primary_memos () && !memos_selected) { GSList selected; calendar_config_set_primary_memos (e_source_peek_uid (source)); @@ -218,6 +221,11 @@ ensure_sources (MemosComponent *component) calendar_config_set_memos_selected (&selected); } + if (memos_selected) { + g_slist_foreach (memos_selected, (GFunc) g_free, NULL); + g_slist_free (memos_selected); + } + e_source_set_color_spec (source, "#BECEDD"); personal_source = source; } diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index 3965517dde..fa2485e7ea 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -200,11 +200,14 @@ ensure_sources (TasksComponent *component) } if (!personal_source) { + GSList *tasks_selected; /* Create the default Person addressbook */ ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI); e_source_group_add_source (on_this_computer, source, -1); - if (!calendar_config_get_primary_tasks () && !calendar_config_get_tasks_selected ()) { + tasks_selected = calendar_config_get_tasks_selected (); + + if (!calendar_config_get_primary_tasks () && !tasks_selected) { GSList selected; calendar_config_set_primary_tasks (e_source_peek_uid (source)); @@ -214,6 +217,11 @@ ensure_sources (TasksComponent *component) calendar_config_set_tasks_selected (&selected); } + if (tasks_selected) { + g_slist_foreach (tasks_selected, (GFunc) g_free, NULL); + g_slist_free (tasks_selected); + } + e_source_set_color_spec (source, "#BECEDD"); personal_source = source; } |