mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-09 08:55:33 +00:00
rtsp-server: 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=753863
This commit is contained in:
parent
9c513cc536
commit
6d20a1c9d9
5 changed files with 10 additions and 0 deletions
|
@ -47,6 +47,8 @@ main (int argc, char *argv[])
|
|||
g_option_context_add_group (optctx, gst_init_get_option_group ());
|
||||
if (!g_option_context_parse (optctx, &argc, &argv, &error)) {
|
||||
g_printerr ("Error parsing options: %s\n", error->message);
|
||||
g_option_context_free (optctx);
|
||||
g_clear_error (&error);
|
||||
return -1;
|
||||
}
|
||||
g_option_context_free (optctx);
|
||||
|
|
|
@ -102,6 +102,8 @@ main (int argc, char *argv[])
|
|||
g_option_context_add_group (optctx, gst_init_get_option_group ());
|
||||
if (!g_option_context_parse (optctx, &argc, &argv, &error)) {
|
||||
g_printerr ("Error parsing options: %s\n", error->message);
|
||||
g_option_context_free (optctx);
|
||||
g_clear_error (&error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,8 @@ main (int argc, char *argv[])
|
|||
g_option_context_add_group (optctx, gst_init_get_option_group ());
|
||||
if (!g_option_context_parse (optctx, &argc, &argv, &error)) {
|
||||
g_printerr ("Error parsing options: %s\n", error->message);
|
||||
g_option_context_free (optctx);
|
||||
g_clear_error (&error);
|
||||
return -1;
|
||||
}
|
||||
g_option_context_free (optctx);
|
||||
|
|
|
@ -49,6 +49,8 @@ main (int argc, char *argv[])
|
|||
g_option_context_add_group (optctx, gst_init_get_option_group ());
|
||||
if (!g_option_context_parse (optctx, &argc, &argv, &error)) {
|
||||
g_printerr ("Error parsing options: %s\n", error->message);
|
||||
g_option_context_free (optctx);
|
||||
g_clear_error (&error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,6 +76,8 @@ main (int argc, gchar * argv[])
|
|||
g_option_context_add_group (optctx, gst_init_get_option_group ());
|
||||
if (!g_option_context_parse (optctx, &argc, &argv, &error)) {
|
||||
g_printerr ("Error parsing options: %s\n", error->message);
|
||||
g_option_context_free (optctx);
|
||||
g_clear_error (&error);
|
||||
return -1;
|
||||
}
|
||||
g_option_context_free (optctx);
|
||||
|
|
Loading…
Reference in a new issue