Permalink
Browse files

Fixed a leak where hid_open weren't freeing a device_path

  • Loading branch information...
1 parent 687a838 commit 110de52c408a4b1c5e58923f13b6cb47932e8588 @pix committed Jul 19, 2011
Showing with 3 additions and 0 deletions.
  1. +3 −0 linux/hid-libusb.c
View
@@ -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;

0 comments on commit 110de52

Please sign in to comment.