[libcamera-devel] [PATCH] libcamera: device_enumerator_udev: Initialize monitor_ and notifier_ to nullptr
Niklas Söderlund
niklas.soderlund at ragnatech.se
Mon Aug 3 01:16:52 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
enumerate(). If the object is deleted without enumerate() being called
the destructor acts on uninitialized pointers, fix this by initializing
them to nullptr.
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)
{
}
--
2.28.0
More information about the libcamera-devel
mailing list