Skip to content

Commit

Permalink
libusb: Fix 'dev' memory leak on hid_init() failure.
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Kleiner <[email protected]>
  • Loading branch information
kleinerm authored and signal11 committed Oct 6, 2013
1 parent 2e27f98 commit 996dafd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libusb/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 996dafd

Please sign in to comment.