summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri Stolnikov <horiz0n@gmx.net>2012-06-02 16:49:51 +0200
committerDimitri Stolnikov <horiz0n@gmx.net>2012-06-02 16:49:51 +0200
commit41eb541606354298003bd853228f1a9674ae0aea (patch)
tree84b6696b3143afdbfad39de9efe6c191bd51adcf
parent292a9868301e364f27412d0348bbeb3714e89b05 (diff)
fix access violation error
-rw-r--r--software/libosmosdr/src/libosmosdr.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/software/libosmosdr/src/libosmosdr.c b/software/libosmosdr/src/libosmosdr.c
index 4bc57b3..485e5a0 100644
--- a/software/libosmosdr/src/libosmosdr.c
+++ b/software/libosmosdr/src/libosmosdr.c
@@ -624,6 +624,8 @@ const char *osmosdr_get_device_name(uint32_t index)
if (index == device_count - 1)
break;
+
+ device = NULL;
}
}
@@ -645,7 +647,6 @@ int osmosdr_get_device_usb_strings(uint32_t index, char *manufact,
libusb_context *ctx;
libusb_device **list;
struct libusb_device_descriptor dd;
- osmosdr_dongle_t *device = NULL;
osmosdr_dev_t devt;
uint32_t device_count = 0;
ssize_t cnt;
@@ -657,22 +658,19 @@ int osmosdr_get_device_usb_strings(uint32_t index, char *manufact,
for (i = 0; i < cnt; i++) {
libusb_get_device_descriptor(list[i], &dd);
- device = find_known_device(dd.idVendor, dd.idProduct);
-
- if (device) {
+ if (find_known_device(dd.idVendor, dd.idProduct))
device_count++;
- if (index == device_count - 1) {
- r = libusb_open(list[i], &devt.devh);
- if (!r) {
- r = osmosdr_get_usb_strings(&devt,
- manufact,
- product,
- serial);
- libusb_close(devt.devh);
- }
- break;
+ if (index == device_count - 1) {
+ r = libusb_open(list[i], &devt.devh);
+ if (!r) {
+ r = osmosdr_get_usb_strings(&devt,
+ manufact,
+ product,
+ serial);
+ libusb_close(devt.devh);
}
+ break;
}
}
@@ -710,9 +708,8 @@ int osmosdr_open(osmosdr_dev_t **out_dev, uint32_t index)
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++;
- }
if (index == device_count - 1)
break;