diff options
author | Vineeth TM <vineeth.tm@samsung.com> | 2015-08-20 16:03:29 +0900 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-10-02 17:24:35 +0300 |
commit | 8c9ca808af4cb49b3bce6dd4f0d02671eba08520 (patch) | |
tree | 5a0a8f86e99979f16e4e45b08e81ccb6bbbe6494 /gst/inter | |
parent | 3b1e0951696298ae373b0a5b1e8216f0e992be7d (diff) | |
download | gstreamer-plugins-bad-8c9ca808af4cb49b3bce6dd4f0d02671eba08520.tar.gz |
gstreamer: bad: 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=753854
Diffstat (limited to 'gst/inter')
-rw-r--r-- | gst/inter/gstintertest.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gst/inter/gstintertest.c b/gst/inter/gstintertest.c index cff4f0dbd..3b1abdb96 100644 --- a/gst/inter/gstintertest.c +++ b/gst/inter/gstintertest.c @@ -85,6 +85,8 @@ main (int argc, char *argv[]) g_option_context_add_group (context, gst_init_get_option_group ()); if (!g_option_context_parse (context, &argc, &argv, &error)) { g_print ("option parsing failed: %s\n", error->message); + g_option_context_free (context); + g_clear_error (&error); exit (1); } g_option_context_free (context); @@ -199,6 +201,7 @@ gst_inter_test_create_pipeline_vts (GstInterTest * intertest) if (error) { g_print ("pipeline parsing error: %s\n", error->message); gst_object_unref (pipeline); + g_clear_error (&error); return; } @@ -236,6 +239,7 @@ gst_inter_test_create_pipeline_server (GstInterTest * intertest) if (error) { g_print ("pipeline parsing error: %s\n", error->message); gst_object_unref (pipeline); + g_clear_error (&error); return; } @@ -352,7 +356,7 @@ gst_inter_test_handle_message (GstBus * bus, GstMessage * message, gst_message_parse_error (message, &error, &debug); gst_inter_test_handle_error (intertest, error, debug); - g_error_free (error); + g_clear_error (&error); g_free (debug); } break; @@ -363,7 +367,7 @@ gst_inter_test_handle_message (GstBus * bus, GstMessage * message, gst_message_parse_warning (message, &error, &debug); gst_inter_test_handle_warning (intertest, error, debug); - g_error_free (error); + g_clear_error (&error); g_free (debug); } break; @@ -374,7 +378,7 @@ gst_inter_test_handle_message (GstBus * bus, GstMessage * message, gst_message_parse_info (message, &error, &debug); gst_inter_test_handle_info (intertest, error, debug); - g_error_free (error); + g_clear_error (&error); g_free (debug); } break; |