diff options
author | Mikko Harju <mikko.harju@jolla.com> | 2015-08-17 16:02:57 +0300 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-08-18 19:59:18 +0000 |
commit | 0b1f439cb294eb4c6e1fe2855b68534e683a165f (patch) | |
tree | 71fa743d044b3a3596dd4dacc70e9ce39cc21899 /src/platformsupport | |
parent | c5ceabb9a1caf6b9b7615a28c3097f221772f645 (diff) |
udev: Do not overwrite original device pointer
Overwriting the original device pointer would unref an incorrect
instance during cleanup, resulting to a memory leak.
Change-Id: Ieac4a2de98eec329aa42dedce9601c44348ba4d9
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Diffstat (limited to 'src/platformsupport')
-rw-r--r-- | src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp b/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp index 8fa82e2ad7..96fa058f78 100644 --- a/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp +++ b/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp @@ -185,11 +185,11 @@ void QDeviceDiscoveryUDev::handleUDevNotification() // if we cannot determine a type, walk up the device tree if (!checkDeviceType(dev)) { // does not increase the refcount - dev = udev_device_get_parent_with_subsystem_devtype(dev, subsystem, 0); - if (!dev) + struct udev_device *parent_dev = udev_device_get_parent_with_subsystem_devtype(dev, subsystem, 0); + if (!parent_dev) goto cleanup; - if (!checkDeviceType(dev)) + if (!checkDeviceType(parent_dev)) goto cleanup; } |