summaryrefslogtreecommitdiff
path: root/src/gstreamer/gstlibcamerapool.cpp
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2021-03-11 15:52:55 -0500
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-03-12 00:46:07 +0200
commit6795ffe67f3318e474ee14141e5b394b0e5d2d85 (patch)
tree0e99f40038c94b92744c7e8ddd5706d206bbd0c7 /src/gstreamer/gstlibcamerapool.cpp
parent488bbe40a9183a6061e4e3fc975d8e289c6f75ac (diff)
gst: pool: Fix GstBuffer leak on error
We borrowed a GstBuffer from the pool, if preparing the buffer failed, we need to push it back to avoid leaking it. Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/gstreamer/gstlibcamerapool.cpp')
-rw-r--r--src/gstreamer/gstlibcamerapool.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gstreamer/gstlibcamerapool.cpp b/src/gstreamer/gstlibcamerapool.cpp
index 62db184f..1fde4213 100644
--- a/src/gstreamer/gstlibcamerapool.cpp
+++ b/src/gstreamer/gstlibcamerapool.cpp
@@ -40,8 +40,10 @@ gst_libcamera_pool_acquire_buffer(GstBufferPool *pool, GstBuffer **buffer,
if (!buf)
return GST_FLOW_ERROR;
- if (!gst_libcamera_allocator_prepare_buffer(self->allocator, self->stream, buf))
+ if (!gst_libcamera_allocator_prepare_buffer(self->allocator, self->stream, buf)) {
+ gst_atomic_queue_push(self->queue, buf);
return GST_FLOW_ERROR;
+ }
*buffer = buf;
return GST_FLOW_OK;