DFU: fix potential leak

This commit is contained in:
Gwenhael Goavec-Merou 2022-06-18 18:47:27 +02:00
parent e21a251af3
commit 780ea66384
1 changed files with 3 additions and 2 deletions

View File

@ -315,10 +315,11 @@ int DFU::searchDFUDevices()
int ret = libusb_open(usb_dev, &handle);
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;
}
libusb_close(handle);
} else if (_debug) {
char mess[256];
sprintf(mess,"Unable to open device: "