Fixed a leak where hid_open weren't freeing a device_path

This commit is contained in:
Camille Moncelier 2011-07-19 11:08:48 +02:00 committed by Alan Ott
parent 8066251aa8
commit 03c407ee89

View File

@ -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;