summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-10-07 12:52:08 +0100
committerPete Batard <pbatard@gmail.com>2010-10-07 12:52:08 +0100
commit2d69de5d13578cfdcac23b16abe0b8f749c34b60 (patch)
treef05dc9182716e43675370ccedea02e00d41441ae
parent7a392930c8a7814eb23b413fc4cfd5350d7a743a (diff)
downloadlibusb-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
-rw-r--r--libusb/os/windows_usb.c13
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);