libusb: Fix 'dev' memory leak on hid_init() failure.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
This commit is contained in:
Mario Kleiner
2013-10-05 18:44:56 +02:00
committed by Alan Ott
parent 2e27f98b3e
commit 996dafd2a8
+2 -2
View File
@@ -790,11 +790,11 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path)
int d = 0;
int good_open = 0;
dev = new_hid_device();
if(hid_init() < 0)
return NULL;
dev = new_hid_device();
libusb_get_device_list(usb_context, &devs);
while ((usb_dev = devs[d++]) != NULL) {
struct libusb_device_descriptor desc;