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

Niklas Söderlund niklas.soderlund at ragnatech.se
Mon Aug 3 10:23:59 CEST 2020


The monitor_ and notifier_ pointers are acted on in the destructor if
not set to nullptr, the pointers are however first initialized in
init() and enumerate(). Avoid acting on uninitialized pointers by
initializing them to nullptr in the constructor.

Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Umang Jain <email at uajain.com>
---
* Changes since v1
- Update commit message
---
 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)
 {
 }
 
-- 
2.28.0



More information about the libcamera-devel mailing list