From 797314e24212d038c19bce217a926c205fa0716b Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 2 Oct 2020 12:33:24 +0200 Subject: [PATCH 1/2] libical-glib: Set owner of the ICalObject only if not adding to the global memory Setting the owner means to add a reference on the owner, which can mean, in case of i_cal_time_get_timezone(), to add a reference on the ICalTime, but this function declares that it wants to use the global memory, where the ownership is assumed by the global pool, not by the ICalTime. This causes a leak of the ICalTime object when the set time zone is added to the global memory for the first time. --- src/libical-glib/i-cal-object.c.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libical-glib/i-cal-object.c.in b/src/libical-glib/i-cal-object.c.in index 1f593a94..23aaddb2 100644 --- a/src/libical-glib/i-cal-object.c.in +++ b/src/libical-glib/i-cal-object.c.in @@ -357,7 +357,9 @@ i_cal_object_construct(GType object_type, iobject->priv->native = native; iobject->priv->native_destroy_func = native_destroy_func; iobject->priv->is_global_memory = is_global_memory; - i_cal_object_set_owner(iobject, owner); + + if (!is_global_memory) + i_cal_object_set_owner(iobject, owner); /* UNLOCK_PROPS (iobject); */ -- 2.26.2