]> www.infradead.org Git - users/dwmw2/ews-sync.git/commitdiff
Avoid double-free of system timezones
authorDavid Woodhouse <dwmw2@infradead.org>
Thu, 22 Jul 2010 15:28:32 +0000 (16:28 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Thu, 22 Jul 2010 15:28:32 +0000 (16:28 +0100)
calitem_to_ical.c

index 34c44075c354a4e9765fb5b8f68bf92823dbbcac..1d56dfd04fb77821659c64e6ae085c1e9c26dc36 100644 (file)
@@ -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);