[v1,3/3] libcamera: framebuffer_allocator: remove entry if allocation fails
diff mbox series

Message ID 20240310012946.727641-4-pobrn@protonmail.com
State Superseded
Headers show
Series
  • couple FrameBufferAllocator changes
Related show

Commit Message

Barnabás Pőcze March 10, 2024, 1:30 a.m. UTC
Remove the entry from the `buffers_` mapping if
`Camera::exportFrameBuffers()` fails, otherwise
there would be a stale entry in the map.
---
 src/libcamera/framebuffer_allocator.cpp | 4 ++++
 1 file changed, 4 insertions(+)

Patch
diff mbox series

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;
 }