From 6e776b8f0f2ef642dfbcb49e26312ba3795947d2 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 23 Mar 2015 10:24:21 +0100 Subject: [PATCH] validate: media-descriptor-parser: fix string leak _set_content() doesn't actually consume @content so the caller is responsible freeing it. --- validate/gst/validate/media-descriptor-parser.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/validate/gst/validate/media-descriptor-parser.c b/validate/gst/validate/media-descriptor-parser.c index 268aecdd3e..ebcd2cd4f9 100644 --- a/validate/gst/validate/media-descriptor-parser.c +++ b/validate/gst/validate/media-descriptor-parser.c @@ -266,13 +266,16 @@ set_xml_path (GstMediaDescriptorParser * parser, const gchar * path, gchar *content; GError *err = NULL; GstMediaDescriptorParserPrivate *priv = parser->priv; + gboolean result; if (!g_file_get_contents (path, &content, &xmlsize, &err)) goto failed; priv->xmlpath = g_strdup (path); - return _set_content (parser, content, xmlsize, error); + result = _set_content (parser, content, xmlsize, error); + g_free (content); + return result; failed: g_propagate_error (error, err); @@ -379,8 +382,7 @@ gst_media_descriptor_parser_new_from_xml (GstValidateRunner * runner, parser = g_object_new (GST_TYPE_MEDIA_DESCRIPTOR_PARSER, "validate-runner", runner, NULL); - if (_set_content (parser, g_strdup (xml), strlen (xml) * sizeof (gchar), - error) == FALSE) { + if (_set_content (parser, xml, strlen (xml) * sizeof (gchar), error) == FALSE) { g_object_unref (parser); return NULL;