mirror of
https://github.com/CTCaer/hidapi.git
synced 2025-02-18 17:57:49 +00:00
Fixed a leak where hid_open weren't freeing a device_path
This commit is contained in:
parent
8066251aa8
commit
03c407ee89
@ -752,6 +752,7 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path)
|
||||
res = libusb_open(usb_dev, &dev->device_handle);
|
||||
if (res < 0) {
|
||||
LOG("can't open device\n");
|
||||
free(dev_path);
|
||||
break;
|
||||
}
|
||||
good_open = 1;
|
||||
@ -763,6 +764,7 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path)
|
||||
if (res < 0) {
|
||||
libusb_close(dev->device_handle);
|
||||
LOG("Unable to detach Kernel Driver\n");
|
||||
free(dev_path);
|
||||
good_open = 0;
|
||||
break;
|
||||
}
|
||||
@ -771,6 +773,7 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path)
|
||||
res = libusb_claim_interface(dev->device_handle, intf_desc->bInterfaceNumber);
|
||||
if (res < 0) {
|
||||
LOG("can't claim interface %d: %d\n", intf_desc->bInterfaceNumber, res);
|
||||
free(dev_path);
|
||||
libusb_close(dev->device_handle);
|
||||
good_open = 0;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user