v4l2: transform: Fix pool leak on error

Also remove un-needed nul checks.

Suggested-by: Elham nikooie
Fixes: #3097
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9221>
This commit is contained in:
Nicolas Dufresne 2025-06-14 12:45:07 -04:00 committed by GStreamer Marge Bot
parent 3c06444a90
commit 491b72aca3

View File

@ -932,6 +932,7 @@ gst_v4l2_transform_prepare_output_buffer (GstBaseTransform * trans,
self->v4l2output->mode == GST_V4L2_IO_DMABUF_IMPORT) {
if (!gst_v4l2_object_try_import (self->v4l2output, inbuf)) {
GST_ERROR_OBJECT (self, "cannot import buffers from upstream");
gst_object_unref (pool);
return GST_FLOW_ERROR;
}
@ -961,8 +962,7 @@ gst_v4l2_transform_prepare_output_buffer (GstBaseTransform * trans,
goto beach;
do {
if (pool)
g_object_unref (pool);
g_object_unref (pool);
pool = gst_base_transform_get_buffer_pool (trans);
if (!gst_buffer_pool_set_active (pool, TRUE))
@ -995,8 +995,7 @@ gst_v4l2_transform_prepare_output_buffer (GstBaseTransform * trans,
}
beach:
if (pool)
g_object_unref (pool);
g_object_unref (pool);
return ret;
activate_failed: