discoverer: free context and error during failures
authorVineeth TM <vineeth.tm@samsung.com>
Mon, 17 Aug 2015 02:18:25 +0000 (11:18 +0900)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 17 Aug 2015 12:11:17 +0000 (14:11 +0200)
When g_option_context_parse or gst_discoverer_new fails, then there will
be memory leaks for ctx and err variables. Free'ing the same.

https://bugzilla.gnome.org/show_bug.cgi?id=753701

tools/gst-discoverer.c

index 045332d..2c088e5 100644 (file)
@@ -555,6 +555,8 @@ main (int argc, char **argv)
 
   if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
     g_print ("Error initializing: %s\n", err->message);
+    g_option_context_free (ctx);
+    g_clear_error (&err);
     exit (1);
   }
 
@@ -568,6 +570,7 @@ main (int argc, char **argv)
   dc = gst_discoverer_new (timeout * GST_SECOND, &err);
   if (G_UNLIKELY (dc == NULL)) {
     g_print ("Error initializing: %s\n", err->message);
+    g_clear_error (&err);
     exit (1);
   }