validate: Fix leak parsing structure files

This commit is contained in:
Thibault Saunier 2020-02-26 10:52:12 -03:00
parent d86fa2c44a
commit 1ee84f7c10

View file

@ -568,6 +568,7 @@ _file_get_structures (GFile * file, gchar ** err)
/* TODO Handle GCancellable */ /* TODO Handle GCancellable */
if (!g_file_load_contents (file, NULL, &content, &size, NULL, &error)) { if (!g_file_load_contents (file, NULL, &content, &size, NULL, &error)) {
GST_WARNING ("Failed to load contents: %d %s", error->code, error->message); GST_WARNING ("Failed to load contents: %d %s", error->code, error->message);
g_free (content);
g_error_free (error); g_error_free (error);
return NULL; return NULL;
} }
@ -652,10 +653,12 @@ _file_get_structures (GFile * file, gchar ** err)
} }
done: done:
g_free (content);
g_free (filename); g_free (filename);
return structures; return structures;
failed: failed:
g_free (content);
if (structures) if (structures)
g_list_free_full (structures, (GDestroyNotify) gst_structure_free); g_list_free_full (structures, (GDestroyNotify) gst_structure_free);
structures = NULL; structures = NULL;