Commit be1b4c74 authored by Bernhard Nortmann's avatar Bernhard Nortmann Committed by Siarhei Siamashka
Browse files

fel: fix memory leak, properly shut down USB library



The aw_fel_process_spl_and_uboot() was missing a free() for the file
buffer. This patch also adds a proper libusb cleanup/shutdown.
Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
Reviewed-by: default avatarSiarhei Siamashka <siarhei.siamashka@gmail.com>
parent 887a0a75
......@@ -1137,6 +1137,7 @@ void aw_fel_process_spl_and_uboot(libusb_device_handle *usb,
/* check for optional main U-Boot binary (and transfer it, if applicable) */
if (size > SPL_LEN_LIMIT)
aw_fel_write_uboot_image(usb, buf + SPL_LEN_LIMIT, size - SPL_LEN_LIMIT);
free(buf);
}
/*
......@@ -1440,6 +1441,8 @@ int main(int argc, char **argv)
if (iface_detached >= 0)
libusb_attach_kernel_driver(handle, iface_detached);
#endif
libusb_close(handle);
libusb_exit(NULL);
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment