gstreamer: Fix memory leaks when context parse fails
[platform/upstream/gstreamer.git] / docs / manual / advanced-dataaccess.xml
index 7f91986..fa56b13 100644 (file)
@@ -311,7 +311,6 @@ main (gint   argc,
         the sink element, unblock the source pads and set the pipeline to
         the playing state. You will see that exactly the requested
         region is played by the sink before it goes to EOS.
-        What follows
       </para>
       <para>
         What follows is an example application that loosly follows this
@@ -916,7 +915,7 @@ main (int argc, char *argv[])
 
   if (error != NULL) {
     g_print ("could not construct pipeline: %s\n", error->message);
-    g_error_free (error);
+    g_clear_error (&error);
     exit (-1);
   }
 
@@ -1476,7 +1475,7 @@ bus_cb (GstBus * bus, GstMessage * msg, gpointer user_data)
 
       gst_message_parse_error (msg, &err, &dbg);
       gst_object_default_error (msg->src, err, dbg);
-      g_error_free (err);
+      g_clear_error (&err);
       g_free (dbg);
       g_main_loop_quit (loop);
       break;
@@ -1506,6 +1505,8 @@ main (int argc, char **argv)
   g_option_context_add_group (ctx, gst_init_get_option_group ());
   if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
     g_print ("Error initializing: %s\n", err->message);
+    g_clear_error (&amp;err);
+    g_option_context_free (ctx);
     return 1;
   }
   g_option_context_free (ctx);