From 3506b02eedc49959bf3e04c7f569ef2b4d8c1ee7 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 23 Apr 2012 16:43:08 +0200 Subject: Fix possible memory leaks of GError structures --- calendar/gui/dialogs/event-page.c | 4 ++-- calendar/gui/dialogs/memo-page.c | 4 ++-- calendar/gui/dialogs/recurrence-page.c | 6 ++++++ calendar/gui/dialogs/task-page.c | 4 ++-- calendar/gui/e-cal-model.c | 1 + 5 files changed, 13 insertions(+), 6 deletions(-) (limited to 'calendar') diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index a3c2b496ea..37373dffa5 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -2920,6 +2920,7 @@ epage_client_opened_cb (GObject *source_object, if (!e_client_utils_open_new_finish (source, result, &client, &error)) { if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_clear_error (&error); return; } } @@ -2946,8 +2947,7 @@ epage_client_opened_cb (GObject *source_object, gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); - if (error) - g_error_free (error); + g_clear_error (&error); } else { gchar *backend_addr = NULL; icaltimezone *zone; diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index 58d3d3b207..00bf1cc79b 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -927,6 +927,7 @@ mpage_client_opened_cb (GObject *source_object, if (!e_client_utils_open_new_finish (source, result, &client, &error)) { if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_clear_error (&error); return; } } @@ -952,8 +953,7 @@ mpage_client_opened_cb (GObject *source_object, gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); - if (error) - g_error_free (error); + g_clear_error (&error); } else { icaltimezone *zone; CompEditorFlags flags; diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 838ab76c4d..56601cee74 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -634,8 +634,11 @@ rpage_get_objects_for_uid_cb (GObject *source_object, ecalcomps = NULL; if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_clear_error (&error); return; } + + g_clear_error (&error); } update_with_readonly (rpage, g_slist_length (ecalcomps) > 1); @@ -659,8 +662,11 @@ rpage_get_object_cb (GObject *source_object, icalcomp = NULL; if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_clear_error (&error); return; } + + g_clear_error (&error); } if (icalcomp) { diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 9e051af37d..27be3bd6bd 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -1755,6 +1755,7 @@ tpage_client_opened_cb (GObject *source_object, if (!e_client_utils_open_new_finish (source, result, &client, &error)) { if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_clear_error (&error); return; } } @@ -1780,8 +1781,7 @@ tpage_client_opened_cb (GObject *source_object, gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); - if (error) - g_error_free (error); + g_clear_error (&error); } else { icaltimezone *zone; ECalClient *cal_client = E_CAL_CLIENT (client); diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index d56b7583fd..d1ab22c989 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -2733,6 +2733,7 @@ get_view_cb (GObject *source_object, } if (gvd->tries < 10) { + g_clear_error (&error); gvd->tries++; g_timeout_add (500, retry_get_view_timeout_cb, gvd); return; -- cgit v1.2.3