Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed segmentation fault in ykcore_libusb.c

  • Loading branch information...
commit a225525f6b0e9e489ef1ac0b488f8f4948a3ba5e 1 parent 5f8cfe6
@Detegr authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 ykcore/ykcore_libusb.c
View
5 ykcore/ykcore_libusb.c
@@ -151,7 +151,7 @@ extern int _ykusb_stop(void)
void *_ykusb_open_device(int vendor_id, int *product_ids, size_t pids_len)
{
struct usb_bus *bus;
- struct usb_device *dev;
+ struct usb_device *dev, *yk_device;
struct usb_dev_handle *h = NULL;
int rc = YK_EUSBERR;
int found = 0;
@@ -164,6 +164,7 @@ void *_ykusb_open_device(int vendor_id, int *product_ids, size_t pids_len)
for (j = 0; j < pids_len; j++) {
if (dev->descriptor.idProduct == product_ids[j]) {
if(found == 0) {
+ yk_device = dev;
found = 1;
break;
} else {
@@ -177,7 +178,7 @@ void *_ykusb_open_device(int vendor_id, int *product_ids, size_t pids_len)
}
if(found == 1) {
rc = YK_EUSBERR;
- h = usb_open(dev);
+ h = usb_open(yk_device);
#ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP
if (h != NULL)
usb_detach_kernel_driver_np(h, 0);
Please sign in to comment.
Something went wrong with that request. Please try again.