From e45b1fd9e67842180c4f4df42498211f6a0a9961 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Fri, 9 May 2014 12:10:04 -0400 Subject: [PATCH] v4l2object: Don't leak config structure this fixes a leak of the config structure and take care of making sure caps can't reach ref 0 before we are done doing our check. CID 1212144 --- sys/v4l2/gstv4l2object.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index 0c73baa..77f8aa4 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -2952,16 +2952,21 @@ gst_v4l2_object_set_crop (GstV4l2Object * obj) gboolean gst_v4l2_object_caps_equal (GstV4l2Object * v4l2object, GstCaps * caps) { - GstStructure *s; + GstStructure *config; GstCaps *oldcaps; + gboolean ret; if (!v4l2object->pool) return FALSE; - s = gst_buffer_pool_get_config (GST_BUFFER_POOL_CAST (v4l2object->pool)); - gst_buffer_pool_config_get_params (s, &oldcaps, NULL, NULL, NULL); + config = gst_buffer_pool_get_config (v4l2object->pool); + gst_buffer_pool_config_get_params (config, &oldcaps, NULL, NULL, NULL); - return oldcaps && gst_caps_is_equal (caps, oldcaps); + ret = oldcaps && gst_caps_is_equal (caps, oldcaps); + + gst_structure_free (config); + + return ret; } gboolean -- 2.7.4