diff options
author | Nathan Hjelm <hjelmn@google.com> | 2021-06-10 21:02:05 -0600 |
---|---|---|
committer | Nathan Hjelm <hjelmn@google.com> | 2021-06-10 21:02:05 -0600 |
commit | 66d058150d9844a8556c37de6b5603c9e18a0330 (patch) | |
tree | 2bb00399c75a459135b67e3c212ccba5975885ff /libusb/hotplug.c | |
parent | a0e773812b8aa07ad57fc092a7a4f406366f5272 (diff) | |
download | libusb-66d058150d9844a8556c37de6b5603c9e18a0330.tar.gz |
core: only increment devices_released when a device is destroyed
Fix a typo in the last commit to ensure the loop does exit when there is
a dangling reference.
Signed-off-by: Nathan Hjelm <hjelmn@google.com>
Diffstat (limited to 'libusb/hotplug.c')
-rw-r--r-- | libusb/hotplug.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libusb/hotplug.c b/libusb/hotplug.c index deb138d..b6f896a 100644 --- a/libusb/hotplug.c +++ b/libusb/hotplug.c @@ -198,10 +198,11 @@ void usbi_hotplug_exit(struct libusb_context *ctx) /* remove the device from the usb_devs list only if there are no * references held, otherwise leave it on the list so that a * warning message will be shown */ - if (usbi_atomic_load(&dev->refcnt) == 1) + if (usbi_atomic_load(&dev->refcnt) == 1) { + ++devices_released; list_del(&dev->list); + } libusb_unref_device(dev); - ++devices_released; } } while (devices_released > 0); |