Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Mikko Harju committed Aug 17, 2015
1 parent a3f35dc commit 3c7f593
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp
Expand Up @@ -206,11 +206,11 @@ void QDeviceDiscovery::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;
}

Expand Down

0 comments on commit 3c7f593

Please sign in to comment.