From 2e2ba223f3a249f1c04fe88c2709ca6e7d42c242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Sun, 10 Mar 2024 14:30:43 +0000 Subject: libcamera: framebuffer_allocator: Remove entry if allocation fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the entry from the `buffers_` mapping if `Camera::exportFrameBuffers()` fails, otherwise there would be a stale entry in the map. Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi Signed-off-by: Kieran Bingham --- src/libcamera/framebuffer_allocator.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libcamera/framebuffer_allocator.cpp b/src/libcamera/framebuffer_allocator.cpp index fc19a33a..dbd0db19 100644 --- a/src/libcamera/framebuffer_allocator.cpp +++ b/src/libcamera/framebuffer_allocator.cpp @@ -97,6 +97,10 @@ int FrameBufferAllocator::allocate(Stream *stream) LOG(Allocator, Error) << "Stream is not part of " << camera_->id() << " active configuration"; + + if (ret < 0) + buffers_.erase(it); + return ret; } -- cgit v1.2.1