diff --git a/gst-libs/gst/tag/mklicensestables.c b/gst-libs/gst/tag/mklicensestables.c index 03abc5829f..87d1205d98 100644 --- a/gst-libs/gst/tag/mklicensestables.c +++ b/gst-libs/gst/tag/mklicensestables.c @@ -415,6 +415,7 @@ parse_license_rdf (const gchar * fn, const gchar * rdf) if (!g_markup_parse_context_parse (ctx, rdf, -1, &err)) { g_error ("Error parsing file %s: %s\n", fn, err->message); + g_clear_error (&err); } licenses = g_list_append (licenses, license); @@ -433,6 +434,7 @@ read_licenses (const gchar * licenses_dir) if (dir == NULL) g_error ("Failed to g_dir_open('%s'): %s", licenses_dir, err->message); + g_clear_error (&err); while ((name = g_dir_read_name (dir))) { gchar *fn, *rdf; @@ -443,7 +445,7 @@ read_licenses (const gchar * licenses_dir) g_free (rdf); } else { g_printerr ("Could not read file '%s': %s\n", fn, err->message); - g_error_free (err); + g_clear_error (&err); err = NULL; } g_free (fn); @@ -722,6 +724,8 @@ main (int argc, char **argv) g_option_context_add_main_entries (ctx, options, NULL); if (!g_option_context_parse (ctx, &argc, &argv, &err)) { g_printerr ("Error initializing: %s\n", err->message); + g_option_context_free (ctx); + g_clear_error (&err); exit (1); } g_option_context_free (ctx); diff --git a/tests/examples/encoding/encoding.c b/tests/examples/encoding/encoding.c index 1861f81f46..83820b7a19 100644 --- a/tests/examples/encoding/encoding.c +++ b/tests/examples/encoding/encoding.c @@ -399,6 +399,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); } diff --git a/tests/examples/playback/playback-test.c b/tests/examples/playback/playback-test.c index d458c2be35..2716464bbd 100644 --- a/tests/examples/playback/playback-test.c +++ b/tests/examples/playback/playback-test.c @@ -1466,6 +1466,7 @@ shot_cb (GtkButton * button, PlaybackApp * app) /* save the pixbuf */ gdk_pixbuf_save (pixbuf, "snapshot.png", "png", &error, NULL); gst_buffer_unmap (buffer, &map); + g_clear_error (&error); done: gst_sample_unref (sample); @@ -3414,6 +3415,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); } g_option_context_free (ctx); diff --git a/tests/examples/seek/jsseek.c b/tests/examples/seek/jsseek.c index 72bca951c5..8a472affe4 100644 --- a/tests/examples/seek/jsseek.c +++ b/tests/examples/seek/jsseek.c @@ -961,9 +961,8 @@ static GstElement * make_parselaunch_pipeline (const gchar * description) { GstElement *pipeline; - GError *error = NULL; - pipeline = gst_parse_launch (description, &error); + pipeline = gst_parse_launch (description, NULL); seekable_elements = g_list_prepend (seekable_elements, pipeline); @@ -2057,9 +2056,7 @@ shot_cb (GtkButton * button, gpointer data) /* save the pixbuf */ gdk_pixbuf_save (pixbuf, "snapshot.png", "png", &error, NULL); gst_buffer_unmap (buffer, &map); - - /* save the pixbuf */ - gdk_pixbuf_save (pixbuf, "snapshot.png", "png", &error, NULL); + g_clear_error (&error); done: gst_buffer_unref (buffer); @@ -2624,7 +2621,7 @@ read_joystick (GIOChannel * source, GIOCondition condition, gpointer user_data) &bytes_read, &err); if (err) { g_print ("error reading from joystick: %s", err->message); - g_error_free (err); + g_clear_error (&err); return FALSE; } else if (bytes_read != sizeof (struct js_event)) { g_print ("error reading joystick, read %u bytes of %u\n", @@ -2678,6 +2675,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); } g_option_context_free (ctx); diff --git a/tests/examples/seek/scrubby.c b/tests/examples/seek/scrubby.c index c5c8d670bb..8afcc8806a 100644 --- a/tests/examples/seek/scrubby.c +++ b/tests/examples/seek/scrubby.c @@ -456,6 +456,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); } diff --git a/tests/icles/stress-playbin.c b/tests/icles/stress-playbin.c index 24498f9252..00bc48ec2f 100644 --- a/tests/icles/stress-playbin.c +++ b/tests/icles/stress-playbin.c @@ -34,7 +34,7 @@ play_file (const gint delay, const gchar * uri) gst_message_parse_error (msg, &gerror, &debug); gst_object_default_error (GST_MESSAGE_SRC (msg), gerror, debug); - g_error_free (gerror); + g_clear_error (&gerror); g_free (debug); break; } @@ -103,6 +103,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", GST_STR_NULL (err->message)); + g_option_context_free (ctx); + g_clear_error (&err); exit (1); } g_option_context_free (ctx); diff --git a/tests/icles/test-effect-switch.c b/tests/icles/test-effect-switch.c index 79b423d28d..fc54a4d39a 100644 --- a/tests/icles/test-effect-switch.c +++ b/tests/icles/test-effect-switch.c @@ -128,7 +128,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; @@ -158,6 +158,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_option_context_free (ctx); + g_clear_error (&err); return 1; } g_option_context_free (ctx); diff --git a/tools/gst-device-monitor.c b/tools/gst-device-monitor.c index c4a1d5ea05..e9c2ed9189 100644 --- a/tools/gst-device-monitor.c +++ b/tools/gst-device-monitor.c @@ -166,6 +166,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", GST_STR_NULL (err->message)); + g_option_context_free (ctx); + g_clear_error (&err); return 1; } g_option_context_free (ctx); diff --git a/tools/gst-discoverer.c b/tools/gst-discoverer.c index 16468aeee4..37bb9859d6 100644 --- a/tools/gst-discoverer.c +++ b/tools/gst-discoverer.c @@ -487,7 +487,7 @@ process_file (GstDiscoverer * dc, const gchar * filename) if (err) { g_warning ("Couldn't convert filename to URI: %s\n", err->message); - g_error_free (err); + g_clear_error (&err); return; } } else { @@ -498,9 +498,9 @@ process_file (GstDiscoverer * dc, const gchar * filename) g_print ("Analyzing %s\n", uri); info = gst_discoverer_discover_uri (dc, uri, &err); print_info (info, err); - if (err) - g_error_free (err); - gst_discoverer_info_unref (info); + g_clear_error (&err); + if (info) + gst_discoverer_info_unref (info); } else { gst_discoverer_discover_uri_async (dc, uri); } diff --git a/tools/gst-play.c b/tools/gst-play.c index 15c9aa26d9..40361c0ade 100644 --- a/tools/gst-play.c +++ b/tools/gst-play.c @@ -352,7 +352,7 @@ play_bus_msg (GstBus * bus, GstMessage * msg, gpointer user_data) g_printerr ("WARNING %s\n", err->message); if (dbg != NULL) g_printerr ("WARNING debug information: %s\n", dbg); - g_error_free (err); + g_clear_error (&err); g_free (dbg); break; } @@ -368,7 +368,7 @@ play_bus_msg (GstBus * bus, GstMessage * msg, gpointer user_data) g_printerr ("ERROR %s for %s\n", err->message, play->uris[play->cur_idx]); if (dbg != NULL) g_printerr ("ERROR debug information: %s\n", dbg); - g_error_free (err); + g_clear_error (&err); g_free (dbg); /* flush any other error messages from the bus and clean up */ @@ -1139,6 +1139,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", GST_STR_NULL (err->message)); + g_option_context_free (ctx); + g_clear_error (&err); return 1; } g_option_context_free (ctx);