[libcamera-devel] [PATCH] libcamera: device_enumerator_udev: Initialize monitor_ and notifier_ to nullptr

Umang Jain email at uajain.com
Mon Aug 3 07:38:30 CEST 2020


Hi Niklas, Laurent,

On 8/3/20 5:01 AM, Laurent Pinchart wrote:
> 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>
Ditto. The commit message is the only change needed.
Reviewed-by: Umang Jain <email at uajain.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)
>>   {
>>   }
>>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20200803/460703aa/attachment.htm>


More information about the libcamera-devel mailing list