From 110de52c408a4b1c5e58923f13b6cb47932e8588 Mon Sep 17 00:00:00 2001 From: Camille Moncelier Date: Tue, 19 Jul 2011 11:08:48 +0200 Subject: [PATCH] Fixed a leak where hid_open weren't freeing a device_path --- linux/hid-libusb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/linux/hid-libusb.c b/linux/hid-libusb.c index 2b0b672..c58ac13 100644 --- a/linux/hid-libusb.c +++ b/linux/hid-libusb.c @@ -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;