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
This commit is contained in:
committed by
Georges Basile Stavracas Neto
parent
948b11fb1c
commit
e48c585c94
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user