xml-formatter: Plug some leaks

This commit is contained in:
Thibault Saunier 2019-06-16 11:09:46 -04:00
parent 90943667ce
commit 032200577a
2 changed files with 8 additions and 4 deletions

View file

@ -30,8 +30,7 @@ GST_DEBUG_CATEGORY_STATIC (base_xml_formatter);
#define parent_class ges_base_xml_formatter_parent_class #define parent_class ges_base_xml_formatter_parent_class
#define _GET_PRIV(o)\ #define _GET_PRIV(o) (((GESBaseXmlFormatter*) o)->priv)
(((GESBaseXmlFormatter*) o)->priv)
static gboolean _loading_done_cb (GESFormatter * self); static gboolean _loading_done_cb (GESFormatter * self);
@ -230,10 +229,12 @@ _load_and_parse (GESBaseXmlFormatter * self, const gchar * uri, GError ** error,
if (!g_file_load_contents (file, NULL, &priv->xmlcontent, &priv->xmlsize, if (!g_file_load_contents (file, NULL, &priv->xmlcontent, &priv->xmlsize,
NULL, &err)) NULL, &err))
goto failed; goto failed;
g_object_unref (file);
return _parse (self, error, state); return _parse (self, error, state);
failed: failed:
g_object_unref (file);
GST_WARNING ("failed to load contents from \"%s\"", uri); GST_WARNING ("failed to load contents from \"%s\"", uri);
g_propagate_error (error, err); g_propagate_error (error, err);
return NULL; return NULL;
@ -498,7 +499,8 @@ _loading_done (GESFormatter * self)
if (priv->state == STATE_LOADING_ASSETS_AND_SYNC) { if (priv->state == STATE_LOADING_ASSETS_AND_SYNC) {
GST_INFO_OBJECT (self, "Assets cached... now loading the timeline."); GST_INFO_OBJECT (self, "Assets cached... now loading the timeline.");
_parse (GES_BASE_XML_FORMATTER (self), NULL, STATE_LOADING_CLIPS); g_markup_parse_context_free (_parse (GES_BASE_XML_FORMATTER (self), NULL,
STATE_LOADING_CLIPS));
g_assert (priv->pending_assets == NULL); g_assert (priv->pending_assets == NULL);
} }
@ -881,6 +883,7 @@ ges_base_xml_formatter_add_clip (GESBaseXmlFormatter * self,
asset, start, inpoint, duration, track_types, metadatas, properties, asset, start, inpoint, duration, track_types, metadatas, properties,
children_properties); children_properties);
gst_object_unref (asset);
if (!nclip) if (!nclip)
return; return;
@ -1160,7 +1163,7 @@ ges_base_xml_formatter_add_encoding_profile (GESBaseXmlFormatter * self,
if (priv->state != STATE_LOADING_ASSETS_AND_SYNC) { if (priv->state != STATE_LOADING_ASSETS_AND_SYNC) {
GST_DEBUG_OBJECT (self, "Not loading encoding profiles in %s state.", GST_DEBUG_OBJECT (self, "Not loading encoding profiles in %s state.",
loading_state_name (priv->state)); loading_state_name (priv->state));
return; goto done;
} }
if (parent == NULL) { if (parent == NULL) {

View file

@ -167,6 +167,7 @@ _parse_encoding_profile (GMarkupParseContext * context,
if (str_preset_properties) { if (str_preset_properties) {
preset_properties = gst_structure_from_string (str_preset_properties, NULL); preset_properties = gst_structure_from_string (str_preset_properties, NULL);
if (preset_properties == NULL) { if (preset_properties == NULL) {
gst_caps_unref (capsformat);
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
"element '%s', Wrong preset-properties format.", element_name); "element '%s', Wrong preset-properties format.", element_name);
return; return;