DFU: fix potential leak
This commit is contained in:
parent
e21a251af3
commit
780ea66384
|
|
@ -315,10 +315,11 @@ int DFU::searchDFUDevices()
|
||||||
|
|
||||||
int ret = libusb_open(usb_dev, &handle);
|
int ret = libusb_open(usb_dev, &handle);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
if (searchIfDFU(handle, usb_dev, &desc) != 0) {
|
ret = searchIfDFU(handle, usb_dev, &desc);
|
||||||
|
libusb_close(handle);
|
||||||
|
if (ret != 0) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
libusb_close(handle);
|
|
||||||
} else if (_debug) {
|
} else if (_debug) {
|
||||||
char mess[256];
|
char mess[256];
|
||||||
sprintf(mess,"Unable to open device: "
|
sprintf(mess,"Unable to open device: "
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue