diff options
-rw-r--r-- | src/datetime-service.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c index 8aa01c0..a10cbb5 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -615,8 +615,8 @@ auth_func (ECal *ecal, static gint compare_comp_instances (gconstpointer ga, gconstpointer gb) { - const struct comp_instance * a = ga; - const struct comp_instance * b = gb; + const struct comp_instance * a = ga; + const struct comp_instance * b = gb; /* sort by start time */ if (a->start < b->start) return -1; @@ -627,11 +627,10 @@ compare_comp_instances (gconstpointer ga, gconstpointer gb) static struct comp_instance* comp_instance_new (ECalComponent * comp, time_t start, time_t end, ESource * source) { - g_object_ref(comp); g_debug("Using times start %s, end %s", ctime(&start), ctime(&end)); struct comp_instance *ci = g_new (struct comp_instance, 1); - ci->comp = comp; + ci->comp = g_object_ref (comp); ci->source = source; ci->start = start; ci->end = end; @@ -640,8 +639,10 @@ comp_instance_new (ECalComponent * comp, time_t start, time_t end, ESource * sou static void comp_instance_free (struct comp_instance* ci) { - g_object_unref (ci->comp); - g_free (ci); + if (ci != NULL) { + g_clear_object (&ci->comp); + g_free (ci); + } } static gboolean |