[evolution] Fix possible memory leaks of GError structures



commit 3506b02eedc49959bf3e04c7f569ef2b4d8c1ee7
Author: Milan Crha <mcrha redhat com>
Date:   Mon Apr 23 16:43:08 2012 +0200

    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 +
 plugins/itip-formatter/itip-formatter.c |    2 +-
 6 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index a3c2b49..37373df 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 58d3d3b..00bf1cc 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 838ab76..56601ce 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 9e051af..27be3bd 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 d56b758..d1ab22c 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;
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 16f7a21..f2e92a0 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -906,7 +906,7 @@ get_object_with_rid_ready_cb (GObject *source_object,
 	if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
 	    g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) ||
 	    g_cancellable_is_cancelled (fd->cancellable)) {
-		g_error_free (error);
+		g_clear_error (&error);
 		find_cal_update_ui (fd, cal_client);
 		decrease_find_data (fd);
 		return;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]