[libcamera-devel] [PATCH 1/2] android: mm: Null check for CameraBufferManager

Hirokazu Honda hiroh at chromium.org
Thu Oct 7 12:35:19 CEST 2021


Hi Umang, thank you for the patch.

On Thu, Oct 7, 2021 at 6:39 PM Umang Jain <umang.jain at ideasonboard.com> wrote:
>
> cros::CameraBufferManager can be nullptr if there is an error in
> its creation. Place a null-check guard to check it.
>
> Signed-off-by: Umang Jain <umang.jain at ideasonboard.com>
> ---
>  src/android/mm/cros_camera_buffer.cpp | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/android/mm/cros_camera_buffer.cpp b/src/android/mm/cros_camera_buffer.cpp
> index 86770135..97a04c68 100644
> --- a/src/android/mm/cros_camera_buffer.cpp
> +++ b/src/android/mm/cros_camera_buffer.cpp
> @@ -60,6 +60,11 @@ CameraBuffer::Private::Private([[maybe_unused]] CameraBuffer *cameraBuffer,
>           registered_(false)
>  {
>         bufferManager_ = cros::CameraBufferManager::GetInstance();
> +       if (!bufferManager_) {
> +               LOG(HAL, Error)

I wonder if this should be Fatal.
I would like to ask others' opinions.

Indeed it is not a big deal.

Reviewed-by: Hirokazu Honda <hiroh at chromium.org>
-Hiro
> +                       << "Failed to get cros CameraBufferManager instance";
> +               return;
> +       }
>
>         int ret = bufferManager_->Register(camera3Buffer);
>         if (ret) {
> --
> 2.31.1
>


More information about the libcamera-devel mailing list