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
This commit is contained in:
Nicolas Dufresne 2014-05-09 12:10:04 -04:00
parent 5284aca559
commit e45b1fd9e6

View file

@ -2952,16 +2952,21 @@ gst_v4l2_object_set_crop (GstV4l2Object * obj)
gboolean gboolean
gst_v4l2_object_caps_equal (GstV4l2Object * v4l2object, GstCaps * caps) gst_v4l2_object_caps_equal (GstV4l2Object * v4l2object, GstCaps * caps)
{ {
GstStructure *s; GstStructure *config;
GstCaps *oldcaps; GstCaps *oldcaps;
gboolean ret;
if (!v4l2object->pool) if (!v4l2object->pool)
return FALSE; return FALSE;
s = gst_buffer_pool_get_config (GST_BUFFER_POOL_CAST (v4l2object->pool)); config = gst_buffer_pool_get_config (v4l2object->pool);
gst_buffer_pool_config_get_params (s, &oldcaps, NULL, NULL, NULL); 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 gboolean