summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVineeth T M <vineeth.tm@samsung.com>2015-08-20 16:51:03 +0900
committerThibault Saunier <tsaunier@gnome.org>2015-11-11 10:12:49 +0100
commitd57fca241a69bccd38241a8f8c6216d2f237bed1 (patch)
tree3cff70158e7a4003de9051feba2e869fc8a631ab
parent1e76d905aebf0f8b8a5f4493cd8468141f5f3417 (diff)
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
-rw-r--r--validate/tools/gst-validate-images-check.c1
-rw-r--r--validate/tools/gst-validate-media-check.c1
-rw-r--r--validate/tools/gst-validate-transcoding.c1
-rw-r--r--validate/tools/gst-validate.c2
4 files changed, 4 insertions, 1 deletions
diff --git a/validate/tools/gst-validate-images-check.c b/validate/tools/gst-validate-images-check.c
index 496b5d4..b900c23 100644
--- a/validate/tools/gst-validate-images-check.c
+++ b/validate/tools/gst-validate-images-check.c
@@ -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;
}
diff --git a/validate/tools/gst-validate-media-check.c b/validate/tools/gst-validate-media-check.c
index e7943a9..d6a3ea1 100644
--- a/validate/tools/gst-validate-media-check.c
+++ b/validate/tools/gst-validate-media-check.c
@@ -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);
}
diff --git a/validate/tools/gst-validate-transcoding.c b/validate/tools/gst-validate-transcoding.c
index ec1b3db..fd8c5f9 100644
--- a/validate/tools/gst-validate-transcoding.c
+++ b/validate/tools/gst-validate-transcoding.c
@@ -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);
}
diff --git a/validate/tools/gst-validate.c b/validate/tools/gst-validate.c
index ddfe065..98f4856 100644
--- a/validate/tools/gst-validate.c
+++ b/validate/tools/gst-validate.c
@@ -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;