[libcamera-devel] [PATCH] libcamera: device_enumerator_udev: Initialize monitor_ and notifier_ to nullptr
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Aug 3 01:31:10 CEST 2020
Hi Niklas,
Thank you for the patch.
On Mon, Aug 03, 2020 at 01:16:52AM +0200, Niklas Söderlund wrote:
> The monitor_ and notifier_ pointers are acted on in the destructor if
> not set to nullptr, the pointers are however first initialized in
> enumerate(). If the object is deleted without enumerate() being called
> the destructor acts on uninitialized pointers, fix this by initializing
> them to nullptr.
Note that monitor_ is created in init(), not enumerate(). The issue is
still the same though, only the commit message should be updated.
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
> src/libcamera/device_enumerator_udev.cpp | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/libcamera/device_enumerator_udev.cpp b/src/libcamera/device_enumerator_udev.cpp
> index 56ca4dc2804b46b9..96689daa5dd113dc 100644
> --- a/src/libcamera/device_enumerator_udev.cpp
> +++ b/src/libcamera/device_enumerator_udev.cpp
> @@ -27,7 +27,7 @@ namespace libcamera {
> LOG_DECLARE_CATEGORY(DeviceEnumerator)
>
> DeviceEnumeratorUdev::DeviceEnumeratorUdev()
> - : udev_(nullptr)
> + : udev_(nullptr), monitor_(nullptr), notifier_(nullptr)
> {
> }
>
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list