diff options
author | Pete Batard <pbatard@gmail.com> | 2010-10-07 12:52:08 +0100 |
---|---|---|
committer | Pete Batard <pbatard@gmail.com> | 2010-10-07 12:52:08 +0100 |
commit | 2d69de5d13578cfdcac23b16abe0b8f749c34b60 (patch) | |
tree | f05dc9182716e43675370ccedea02e00d41441ae /libusb | |
parent | 7a392930c8a7814eb23b413fc4cfd5350d7a743a (diff) | |
download | libusb-2d69de5d13578cfdcac23b16abe0b8f749c34b60.tar.gz |
fixed double listing of devices in discovered list
* devices should be added to discdevs only when created
* issue reported by Xiaofan Chen
Diffstat (limited to 'libusb')
-rw-r--r-- | libusb/os/windows_usb.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c index 4ff4d6a..9b279d6 100644 --- a/libusb/os/windows_usb.c +++ b/libusb/os/windows_usb.c @@ -1373,13 +1373,14 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered (*unref_cur)->dev = dev; (*unref_cur)->next = NULL; unref_cur = &((*unref_cur)->next); - } - if (pass != HCD_PASS) { - discdevs = discovered_devs_append(*_discdevs, dev); - if (!discdevs) { - LOOP_BREAK(LIBUSB_ERROR_NO_MEM); + // Append newly created devices to the list of discovered devices + if (pass != HCD_PASS) { + discdevs = discovered_devs_append(*_discdevs, dev); + if (!discdevs) { + LOOP_BREAK(LIBUSB_ERROR_NO_MEM); + } + *_discdevs = discdevs; } - *_discdevs = discdevs; } priv = __device_priv(dev); |