summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorVineeth TM <vineeth.tm@samsung.com>2015-08-07 10:08:21 +0900
committerSebastian Dröge <sebastian@centricular.com>2015-08-07 10:17:02 +0200
commit0eb9dde1e803cfff490632553a13f705693710b6 (patch)
tree499a1330cdc5b4300f673b85e19e049fc3cc8f5a /gst
parent749810b238396c608c6992d3fb6745f892df4541 (diff)
value: free caps during failure
While calling gst_value_deserialize_sample, if there is a failure after caps is ref'ed, then caps is getting leaked. Hence checking for caps in fail: goto condition and unref'ing it https://bugzilla.gnome.org/show_bug.cgi?id=753338
Diffstat (limited to 'gst')
-rw-r--r--gst/gstvalue.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/gst/gstvalue.c b/gst/gstvalue.c
index 8bd16dcc3..37a59bff8 100644
--- a/gst/gstvalue.c
+++ b/gst/gstvalue.c
@@ -2445,7 +2445,7 @@ gst_value_deserialize_sample (GValue * dest, const gchar * s)
GValue bval = G_VALUE_INIT, sval = G_VALUE_INIT;
GstStructure *info;
GstSample *sample;
- GstCaps *caps;
+ GstCaps *caps = NULL;
gboolean ret = FALSE;
gchar **fields;
gsize outlen;
@@ -2471,8 +2471,6 @@ gst_value_deserialize_sample (GValue * dest, const gchar * s)
caps = gst_caps_from_string (fields[1]);
if (caps == NULL)
goto fail;
- } else {
- caps = NULL;
}
if (strcmp (fields[2], "None") != 0) {
@@ -2499,13 +2497,11 @@ gst_value_deserialize_sample (GValue * dest, const gchar * s)
g_value_take_boxed (dest, sample);
- if (caps)
- gst_caps_unref (caps);
-
ret = TRUE;
fail:
-
+ if (caps)
+ gst_caps_unref (caps);
g_value_unset (&bval);
g_value_unset (&sval);