From f99b0f7f8f51e13618b4aededf1564af803d28da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Sat, 15 Apr 2023 21:03:40 +0000 Subject: libcamera: device_enumerator_udev: Remove devnum from dependency map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, after `addV4L2Device()` had seen all dependecies, it would remove the `MediaDeviceDeps` object from the `pending_` list, which would result in it being destroyed. However, there would still be (dangling) pointers to this object in `devMap_` that were added in `addUdevDevice()` (line 103). So remove the entry with the given devnum when it is removed from the corresponding `MediaDeviceDeps` object. Signed-off-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Signed-off-by: Laurent Pinchart --- src/libcamera/device_enumerator_udev.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/libcamera/device_enumerator_udev.cpp b/src/libcamera/device_enumerator_udev.cpp index 5317afbd..a63cd360 100644 --- a/src/libcamera/device_enumerator_udev.cpp +++ b/src/libcamera/device_enumerator_udev.cpp @@ -315,6 +315,7 @@ int DeviceEnumeratorUdev::addV4L2Device(dev_t devnum) * enumerator. */ deps->deps_.erase(devnum); + devMap_.erase(it); if (deps->deps_.empty()) { LOG(DeviceEnumerator, Debug) -- cgit v1.2.1