[PATCH v2 3/3] libcamera: framebuffer_allocator: Remove entry if allocation fails

Jacopo Mondi jacopo.mondi at ideasonboard.com
Mon Mar 11 18:03:06 CET 2024


Hi Barnabás

On Sun, Mar 10, 2024 at 02:30:43PM +0000, Barnabás Pőcze wrote:
> 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 <pobrn at protonmail.com>

Reviewed-by: Jacopo Mondi <jacopo.mondi at ideasonboard.com>

Thanks
  j

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


More information about the libcamera-devel mailing list