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>
This commit is contained in:
parent
c5ceabb9a1
commit
0b1f439cb2
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user