From: David Woodhouse Date: Thu, 22 Jul 2010 15:28:32 +0000 (+0100) Subject: Avoid double-free of system timezones X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c9fa91eb9b18faeb44661a791d86cb7e367efc14;p=users%2Fdwmw2%2Fews-sync.git Avoid double-free of system timezones --- diff --git a/calitem_to_ical.c b/calitem_to_ical.c index 34c4407..1d56dfd 100644 --- a/calitem_to_ical.c +++ b/calitem_to_ical.c @@ -67,7 +67,6 @@ icalcomponent *ews_calitem_to_ical(xmlNode *xml_node, const gchar *parent_id, const char **modifia = NULL; int i, deletia_count = 0, modifia_count = 0; icaltimezone *icaltz; - gboolean freetz = FALSE; icalcomponent *comp, *calcomp; icalproperty *prop; gboolean allday = FALSE; @@ -85,9 +84,7 @@ icalcomponent *ews_calitem_to_ical(xmlNode *xml_node, const gchar *parent_id, icalcomponent_add_property(calcomp, prop); icaltz = get_meeting_timezone(xml_node, error); - if (icaltz) - freetz = TRUE; - else + if (!icaltz) icaltz = get_timezone(xml_node, error); if (icaltz) { @@ -249,7 +246,7 @@ icalcomponent *ews_calitem_to_ical(xmlNode *xml_node, const gchar *parent_id, } } - if (freetz) + if (!parent_zone) icaltimezone_free(icaltz, 1); return calcomp?:comp; @@ -918,7 +915,7 @@ icaltimezone *get_timezone(xmlNode *xml_node, GError **error) zone = icaltimezone_get_builtin_timezone(tzname); if (zone) - return zone; + return icaltimezone_copy(zone); g_warning("Failed to load ical timezone for '%s' (%s)", tzname, ews_tzname);