[gnome-calendar] event: fix crash when no end date is given
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] event: fix crash when no end date is given
- Date: Tue, 8 Mar 2016 03:49:38 +0000 (UTC)
commit e48c585c945848799ed0489f544644b4e645b4a3
Author: Monique Faria <mnfaria inf ufpel edu br>
Date: Tue Mar 8 00:03:42 2016 -0300
event: fix crash when no end date is given
In this commit, we fixed a crash report that occurred when an event had no end date.
Events with no end dates are all-day, 1-day length events. But, when an event with no end date set was
synchronized with calendar (happened mostly with birthdays), it caused crashes, because the function
responsible for getting the end date received NULL.
To correct this, we considered that end = start + 1day when no end date is set. With this, the mistake
was corrected. Another thing that was correct along with this were two memory leaks, caused by the allocation
of both end and start date that were not been freed.
https://bugzilla.gnome.org/show_bug.cgi?id=762985
src/gcal-event.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-event.c b/src/gcal-event.c
index 145d7f9..a3916c2 100644
--- a/src/gcal-event.c
+++ b/src/gcal-event.c
@@ -222,6 +222,13 @@ gcal_event_set_component_internal (GcalEvent *self,
/* Setup end date */
e_cal_component_get_dtend (component, &end);
+
+ if(!end.value)
+ {
+ end = start;
+ end.value->day = start.value->day + 1;
+ }
+
date = icaltime_normalize (*end.value);
zone_end = get_timezone_from_ical (&end);
date_end = g_date_time_new (zone_end,
@@ -250,6 +257,9 @@ gcal_event_set_component_internal (GcalEvent *self,
g_clear_pointer (&zone_start, g_time_zone_unref);
g_clear_pointer (&zone_end, g_time_zone_unref);
g_clear_pointer (&description, g_free);
+
+ e_cal_component_free_datetime(&start);
+ e_cal_component_free_datetime(&end);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]