mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 13:06:23 +00:00
v4l2object: Don't leak downstream pool in propose_allocation
parse_nth_allocation_pool() give a ref on the pool, we need to unref it when done.
This commit is contained in:
parent
eee61f39e5
commit
d3383f9d4c
1 changed files with 13 additions and 4 deletions
|
@ -3120,7 +3120,7 @@ gst_v4l2_object_decide_allocation (GstV4l2Object * obj, GstQuery * query)
|
||||||
/* no downstream pool, use our own then */
|
/* no downstream pool, use our own then */
|
||||||
GST_DEBUG_OBJECT (obj->element,
|
GST_DEBUG_OBJECT (obj->element,
|
||||||
"read/write mode: no downstream pool, using our own");
|
"read/write mode: no downstream pool, using our own");
|
||||||
pool = obj->pool;
|
pool = gst_object_ref (obj->pool);
|
||||||
size = obj->sizeimage;
|
size = obj->sizeimage;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -3134,7 +3134,7 @@ gst_v4l2_object_decide_allocation (GstV4l2Object * obj, GstQuery * query)
|
||||||
if (can_use_own_pool) {
|
if (can_use_own_pool) {
|
||||||
if (pool)
|
if (pool)
|
||||||
gst_object_unref (pool);
|
gst_object_unref (pool);
|
||||||
pool = obj->pool;
|
pool = gst_object_ref (obj->pool);
|
||||||
size = obj->sizeimage;
|
size = obj->sizeimage;
|
||||||
GST_DEBUG_OBJECT (obj->element,
|
GST_DEBUG_OBJECT (obj->element,
|
||||||
"streaming mode: using our own pool %" GST_PTR_FORMAT, pool);
|
"streaming mode: using our own pool %" GST_PTR_FORMAT, pool);
|
||||||
|
@ -3224,23 +3224,32 @@ done:
|
||||||
else
|
else
|
||||||
gst_query_add_allocation_pool (query, pool, size, min, max);
|
gst_query_add_allocation_pool (query, pool, size, min, max);
|
||||||
|
|
||||||
|
if (pool)
|
||||||
|
gst_object_unref (pool);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
pool_failed:
|
pool_failed:
|
||||||
{
|
{
|
||||||
/* setup_pool already send the error */
|
/* setup_pool already send the error */
|
||||||
return FALSE;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
config_failed:
|
config_failed:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (obj->element, RESOURCE, SETTINGS,
|
GST_ELEMENT_ERROR (obj->element, RESOURCE, SETTINGS,
|
||||||
(_("Failed to configure internal buffer pool.")), (NULL));
|
(_("Failed to configure internal buffer pool.")), (NULL));
|
||||||
return FALSE;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
no_size:
|
no_size:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (obj->element, RESOURCE, SETTINGS,
|
GST_ELEMENT_ERROR (obj->element, RESOURCE, SETTINGS,
|
||||||
(_("Video device did not suggest any buffer size.")), (NULL));
|
(_("Video device did not suggest any buffer size.")), (NULL));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
cleanup:
|
||||||
|
{
|
||||||
|
if (pool)
|
||||||
|
gst_object_unref (pool);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue