validate: media-check: don't leak output_file and expected_file

This commit is contained in:
Guillaume Desmottes 2015-03-26 15:39:12 +01:00
parent 4f805422a7
commit 779e44dd36

View file

@ -46,8 +46,8 @@ main (int argc, gchar ** argv)
gchar *output_file = NULL; gchar *output_file = NULL;
gchar *expected_file = NULL; gchar *expected_file = NULL;
gchar *output = NULL; gchar *output = NULL;
GstMediaDescriptorWriter *writer; GstMediaDescriptorWriter *writer = NULL;
GstValidateRunner *runner; GstValidateRunner *runner = NULL;
GstMediaDescriptorParser *reference = NULL; GstMediaDescriptorParser *reference = NULL;
GOptionEntry options[] = { GOptionEntry options[] = {
@ -88,7 +88,8 @@ main (int argc, gchar ** argv)
g_printerr ("%s\n", msg); g_printerr ("%s\n", msg);
g_free (msg); g_free (msg);
g_option_context_free (ctx); g_option_context_free (ctx);
return 1; ret = 1;
goto out;
} }
g_option_context_free (ctx); g_option_context_free (ctx);
@ -97,7 +98,8 @@ main (int argc, gchar ** argv)
gst_media_descriptor_writer_new_discover (runner, argv[1], full, &err); gst_media_descriptor_writer_new_discover (runner, argv[1], full, &err);
if (writer == NULL) { if (writer == NULL) {
g_print ("Could not discover file: %s", argv[1]); g_print ("Could not discover file: %s", argv[1]);
return 1; ret = 1;
goto out;
} }
if (output_file) if (output_file)
@ -109,8 +111,8 @@ main (int argc, gchar ** argv)
if (reference == NULL) { if (reference == NULL) {
g_print ("Could not parse file: %s", expected_file); g_print ("Could not parse file: %s", expected_file);
gst_object_unref (writer); gst_object_unref (writer);
ret = 1;
return 1; goto out;
} }
gst_media_descriptors_compare (GST_MEDIA_DESCRIPTOR (reference), gst_media_descriptors_compare (GST_MEDIA_DESCRIPTOR (reference),
@ -128,10 +130,16 @@ main (int argc, gchar ** argv)
g_free (output); g_free (output);
} }
out:
g_free (output_file);
g_free (expected_file);
if (reference) if (reference)
gst_object_unref (reference); gst_object_unref (reference);
gst_object_unref (writer); if (writer)
gst_object_unref (runner); gst_object_unref (writer);
if (runner)
gst_object_unref (runner);
gst_deinit (); gst_deinit ();
return ret; return ret;