xml-formatter: Plug leaks of pending groups
authorThibault Saunier <tsaunier@igalia.com>
Thu, 28 Mar 2019 16:06:16 +0000 (13:06 -0300)
committerThibault Saunier <tsaunier@igalia.com>
Mon, 15 Apr 2019 21:11:48 +0000 (17:11 -0400)
ges/ges-base-xml-formatter.c
tests/check/ges/group.c

index f845f66..2f7b97a 100644 (file)
@@ -146,6 +146,16 @@ _free_layer_entry (LayerEntry * entry)
   g_slice_free (LayerEntry, entry);
 }
 
+static void
+_free_pending_group (PendingGroup * pgroup)
+{
+  if (pgroup->group)
+    g_object_unref (pgroup->group);
+  g_list_free (pgroup->pending_children);
+  g_slice_free (PendingGroup, pgroup);
+}
+
+
 /*
 enum
 {
@@ -368,6 +378,9 @@ _finalize (GObject * object)
   if (priv->parsecontext != NULL)
     g_markup_parse_context_free (priv->parsecontext);
 
+  g_list_free_full (priv->groups, (GDestroyNotify) _free_pending_group);
+  priv->groups = NULL;
+
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
@@ -464,7 +477,11 @@ _add_all_groups (GESFormatter * self)
           GES_TIMELINE_ELEMENT_NAME (child));
       ges_container_add (GES_CONTAINER (pgroup->group), child);
     }
+    pgroup->group = NULL;
   }
+
+  g_list_free_full (priv->groups, (GDestroyNotify) _free_pending_group);
+  priv->groups = NULL;
 }
 
 static void
index 373eacf..aa24646 100644 (file)
@@ -674,6 +674,7 @@ GST_START_TEST (test_group_serialization)
 
 
   g_free (tmpuri);
+  gst_object_unref (timeline);
 
   ges_deinit ();
 }