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 /tools | |
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 'tools')
-rwxr-xr-x | tools/gst-app-maker | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/gst-app-maker b/tools/gst-app-maker index 786cd64a7..f3c3d1f30 100755 --- a/tools/gst-app-maker +++ b/tools/gst-app-maker @@ -151,6 +151,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_clear_error (&error); + g_option_context_free (context); exit (1); } g_option_context_free (context); @@ -223,6 +225,7 @@ gst_replace_create_pipeline_playbin (GstReplace *replace, const char *uri) if (error) { g_print("pipeline parsing error: %s\n", error->message); + g_clear_error (&error); gst_object_unref (pipeline); return; } @@ -262,6 +265,7 @@ gst_replace_create_pipeline (GstReplace *replace) if (error) { g_print("pipeline parsing error: %s\n", error->message); + g_clear_error (&error); gst_object_unref (pipeline); return; } @@ -378,6 +382,7 @@ gst_replace_handle_message (GstBus *bus, GstMessage *message, gst_message_parse_error (message, &error, &debug); gst_replace_handle_error (replace, error, debug); + g_clear_error (&error); } break; case GST_MESSAGE_WARNING: @@ -387,6 +392,7 @@ gst_replace_handle_message (GstBus *bus, GstMessage *message, gst_message_parse_warning (message, &error, &debug); gst_replace_handle_warning (replace, error, debug); + g_clear_error (&error); } break; case GST_MESSAGE_INFO: @@ -396,6 +402,7 @@ gst_replace_handle_message (GstBus *bus, GstMessage *message, gst_message_parse_info (message, &error, &debug); gst_replace_handle_info (replace, error, debug); + g_clear_error (&error); } break; case GST_MESSAGE_TAG: |