mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
validate: Fix memory leaks when context parse fails
When g_option_context_parse fails, context and error variables are not getting free'd which results in memory leaks. Free'ing the same. And replacing g_error_free with g_clear_error, which checks if the error being passed is not NULL and sets the variable to NULL on free'ing. https://bugzilla.gnome.org/show_bug.cgi?id=753862
This commit is contained in:
parent
1e76d905ae
commit
d57fca241a
4 changed files with 4 additions and 1 deletions
|
@ -75,6 +75,7 @@ main (int argc, char **argv)
|
|||
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);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ main (int argc, gchar ** argv)
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -873,6 +873,7 @@ main (int argc, gchar ** argv)
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data)
|
|||
if (debug)
|
||||
g_print ("Additional debug info:\n%s\n", debug);
|
||||
|
||||
g_error_free (gerror);
|
||||
g_clear_error (&gerror);
|
||||
g_free (debug);
|
||||
g_free (name);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue