fix access violation error
This commit is contained in:
parent
292a986830
commit
41eb541606
|
@ -624,6 +624,8 @@ const char *osmosdr_get_device_name(uint32_t index)
|
||||||
|
|
||||||
if (index == device_count - 1)
|
if (index == device_count - 1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
device = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -645,7 +647,6 @@ int osmosdr_get_device_usb_strings(uint32_t index, char *manufact,
|
||||||
libusb_context *ctx;
|
libusb_context *ctx;
|
||||||
libusb_device **list;
|
libusb_device **list;
|
||||||
struct libusb_device_descriptor dd;
|
struct libusb_device_descriptor dd;
|
||||||
osmosdr_dongle_t *device = NULL;
|
|
||||||
osmosdr_dev_t devt;
|
osmosdr_dev_t devt;
|
||||||
uint32_t device_count = 0;
|
uint32_t device_count = 0;
|
||||||
ssize_t cnt;
|
ssize_t cnt;
|
||||||
|
@ -657,22 +658,19 @@ int osmosdr_get_device_usb_strings(uint32_t index, char *manufact,
|
||||||
for (i = 0; i < cnt; i++) {
|
for (i = 0; i < cnt; i++) {
|
||||||
libusb_get_device_descriptor(list[i], &dd);
|
libusb_get_device_descriptor(list[i], &dd);
|
||||||
|
|
||||||
device = find_known_device(dd.idVendor, dd.idProduct);
|
if (find_known_device(dd.idVendor, dd.idProduct))
|
||||||
|
|
||||||
if (device) {
|
|
||||||
device_count++;
|
device_count++;
|
||||||
|
|
||||||
if (index == device_count - 1) {
|
if (index == device_count - 1) {
|
||||||
r = libusb_open(list[i], &devt.devh);
|
r = libusb_open(list[i], &devt.devh);
|
||||||
if (!r) {
|
if (!r) {
|
||||||
r = osmosdr_get_usb_strings(&devt,
|
r = osmosdr_get_usb_strings(&devt,
|
||||||
manufact,
|
manufact,
|
||||||
product,
|
product,
|
||||||
serial);
|
serial);
|
||||||
libusb_close(devt.devh);
|
libusb_close(devt.devh);
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -710,9 +708,8 @@ int osmosdr_open(osmosdr_dev_t **out_dev, uint32_t index)
|
||||||
|
|
||||||
libusb_get_device_descriptor(list[i], &dd);
|
libusb_get_device_descriptor(list[i], &dd);
|
||||||
|
|
||||||
if (find_known_device(dd.idVendor, dd.idProduct)) {
|
if (find_known_device(dd.idVendor, dd.idProduct))
|
||||||
device_count++;
|
device_count++;
|
||||||
}
|
|
||||||
|
|
||||||
if (index == device_count - 1)
|
if (index == device_count - 1)
|
||||||
break;
|
break;
|
||||||
|
|
Reference in New Issue