From adc4843f53ea583a32a45c1f0a54c586554759e0 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 28 Mar 2019 13:06:16 -0300 Subject: [PATCH] xml-formatter: Plug leaks of pending groups --- ges/ges-base-xml-formatter.c | 17 +++++++++++++++++ tests/check/ges/group.c | 1 + 2 files changed, 18 insertions(+) diff --git a/ges/ges-base-xml-formatter.c b/ges/ges-base-xml-formatter.c index f845f66063..2f7b97a4ea 100644 --- a/ges/ges-base-xml-formatter.c +++ b/ges/ges-base-xml-formatter.c @@ -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 diff --git a/tests/check/ges/group.c b/tests/check/ges/group.c index 373eacfa5b..aa246463ff 100644 --- a/tests/check/ges/group.c +++ b/tests/check/ges/group.c @@ -674,6 +674,7 @@ GST_START_TEST (test_group_serialization) g_free (tmpuri); + gst_object_unref (timeline); ges_deinit (); }