aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-06-30 05:08:37 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-09-14 20:08:33 +0800
commit19307b54bc826cebbdea8cd7e1cdd8499bc1076f (patch)
tree4ac607b111a61163647ee777339fc5d1b490b4f0 /calendar
parenta624e7b4836cf810a528ea422e9961b2babf88fc (diff)
downloadgsoc2013-evolution-19307b54bc826cebbdea8cd7e1cdd8499bc1076f.tar
gsoc2013-evolution-19307b54bc826cebbdea8cd7e1cdd8499bc1076f.tar.gz
gsoc2013-evolution-19307b54bc826cebbdea8cd7e1cdd8499bc1076f.tar.bz2
gsoc2013-evolution-19307b54bc826cebbdea8cd7e1cdd8499bc1076f.tar.lz
gsoc2013-evolution-19307b54bc826cebbdea8cd7e1cdd8499bc1076f.tar.xz
gsoc2013-evolution-19307b54bc826cebbdea8cd7e1cdd8499bc1076f.tar.zst
gsoc2013-evolution-19307b54bc826cebbdea8cd7e1cdd8499bc1076f.zip
Add a bit more error checking and do not leak icalcomponent-s
Diffstat (limited to 'calendar')
-rw-r--r--calendar/gui/comp-util.c11
-rw-r--r--calendar/gui/e-calendar-selector.c8
-rw-r--r--calendar/gui/e-calendar-view.c2
-rw-r--r--calendar/gui/e-memo-list-selector.c8
-rw-r--r--calendar/gui/e-task-list-selector.c8
5 files changed, 27 insertions, 10 deletions
diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c
index a6095d0bcc..d44914fb46 100644
--- a/calendar/gui/comp-util.c
+++ b/calendar/gui/comp-util.c
@@ -722,7 +722,12 @@ comp_util_sanitize_recurrence_master (ECalComponent *comp,
}
master = e_cal_component_new ();
- e_cal_component_set_icalcomponent (master, icalcomp);
+ if (!e_cal_component_set_icalcomponent (master, icalcomp)) {
+ icalcomponent_free (icalcomp);
+ g_object_unref (master);
+ g_return_if_reached ();
+ return;
+ }
/* Compare recur id and start date */
e_cal_component_get_recurid (comp, &rid);
@@ -739,6 +744,10 @@ comp_util_sanitize_recurrence_master (ECalComponent *comp,
e_cal_component_get_dtend (comp, &edt);
+ g_return_if_fail (msdt.value != NULL);
+ g_return_if_fail (medt.value != NULL);
+ g_return_if_fail (edt.value != NULL);
+
sdt.value->year = msdt.value->year;
sdt.value->month = msdt.value->month;
sdt.value->day = msdt.value->day;
diff --git a/calendar/gui/e-calendar-selector.c b/calendar/gui/e-calendar-selector.c
index d31578cbd0..1a70ebb387 100644
--- a/calendar/gui/e-calendar-selector.c
+++ b/calendar/gui/e-calendar-selector.c
@@ -43,9 +43,11 @@ calendar_selector_update_single_object (ECalClient *client,
uid = (gchar *) icalcomponent_get_uid (icalcomp);
- if (e_cal_client_get_object_sync (client, uid, NULL, &tmp_icalcomp, NULL, NULL))
- return e_cal_client_modify_object_sync (
- client, icalcomp, CALOBJ_MOD_ALL, NULL, NULL);
+ if (e_cal_client_get_object_sync (client, uid, NULL, &tmp_icalcomp, NULL, NULL)) {
+ icalcomponent_free (tmp_icalcomp);
+
+ return e_cal_client_modify_object_sync (client, icalcomp, CALOBJ_MOD_ALL, NULL, NULL);
+ }
uid = NULL;
if (!e_cal_client_create_object_sync (client, icalcomp, &uid, NULL, NULL))
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 32c5301fe1..8f87026f65 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -2091,6 +2091,8 @@ e_calendar_view_get_icalcomponent_summary (ECalClient *client, icalcomponent *ic
summary = g_strdup_printf ("%s (%d)", summary ? summary : "", dtnow.year - dtstart.year);
*free_text = summary != NULL;
}
+
+ icalcomponent_free (item_icalcomp);
}
}
diff --git a/calendar/gui/e-memo-list-selector.c b/calendar/gui/e-memo-list-selector.c
index abc4bf9bf3..cbcd0025e1 100644
--- a/calendar/gui/e-memo-list-selector.c
+++ b/calendar/gui/e-memo-list-selector.c
@@ -45,9 +45,11 @@ memo_list_selector_update_single_object (ECalClient *client,
uid = (gchar *) icalcomponent_get_uid (icalcomp);
- if (e_cal_client_get_object_sync (client, uid, NULL, &tmp_icalcomp, NULL, NULL))
- return e_cal_client_modify_object_sync (
- client, icalcomp, CALOBJ_MOD_ALL, NULL, NULL);
+ if (e_cal_client_get_object_sync (client, uid, NULL, &tmp_icalcomp, NULL, NULL)) {
+ icalcomponent_free (tmp_icalcomp);
+
+ return e_cal_client_modify_object_sync (client, icalcomp, CALOBJ_MOD_ALL, NULL, NULL);
+ }
if (!e_cal_client_create_object_sync (client, icalcomp, &uid, NULL, NULL))
return FALSE;
diff --git a/calendar/gui/e-task-list-selector.c b/calendar/gui/e-task-list-selector.c
index 9d1fb5cb99..ff4e187877 100644
--- a/calendar/gui/e-task-list-selector.c
+++ b/calendar/gui/e-task-list-selector.c
@@ -45,9 +45,11 @@ task_list_selector_update_single_object (ECalClient *client,
uid = (gchar *) icalcomponent_get_uid (icalcomp);
- if (e_cal_client_get_object_sync (client, uid, NULL, &tmp_icalcomp, NULL, NULL))
- return e_cal_client_modify_object_sync (
- client, icalcomp, CALOBJ_MOD_ALL, NULL, NULL);
+ if (e_cal_client_get_object_sync (client, uid, NULL, &tmp_icalcomp, NULL, NULL)) {
+ icalcomponent_free (tmp_icalcomp);
+
+ return e_cal_client_modify_object_sync (client, icalcomp, CALOBJ_MOD_ALL, NULL, NULL);
+ }
if (!e_cal_client_create_object_sync (client, icalcomp, &uid, NULL, NULL))
return FALSE;