[evolution/gnome-3-4] Fix possible memory leaks of GError structures
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-4] Fix possible memory leaks of GError structures
- Date: Mon, 23 Apr 2012 14:45:01 +0000 (UTC)
commit b8dcb774d37c7ce7b3c9f7cd829c6ab08c298386
Author: Milan Crha <mcrha redhat com>
Date: Mon Apr 23 16:44:37 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 086f3ef..3697ce5 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -2918,6 +2918,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;
}
}
@@ -2944,8 +2945,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 5348a19..bcac7ad 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 71a4945..d0395cb 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 20dee7f..d3c9a52 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 3877e37..8095d26 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -899,7 +899,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]