zephyr/drivers/usb
Steven Slupsky 32f4f8d987 drivers: usb: usb_dc_sam0: fix memory leak
The usb_dc_sam0 driver is leaking memory when the usb device is detached
using usb_disable().

When a device is detached, the driver does not reliably deallocate the
descriptor bank memory. Therefore, upon the next attach and configure,
another block of memory is allocated. After several connect /
disconnect sequences, the usb interface becomes unresponsive.

This commit adds a static function to release all memory allocated
to the ep descriptors when usb_dc_detach() is called.  Since detach is
called from usb_disable(), this releases the memory when the
interface is disabled.

Avoid calling k_free() if buffer pointer is already
set to NULL.

Fixes #49177

Signed-off-by: Steven Slupsky <sslupsky@gmail.com>
2022-09-19 15:20:53 -05:00
..
device drivers: usb: usb_dc_sam0: fix memory leak 2022-09-19 15:20:53 -05:00
CMakeLists.txt usb: remove Kconfig option CONFIG_USB 2021-08-03 19:00:12 -04:00
Kconfig usb: remove Kconfig option CONFIG_USB 2021-08-03 19:00:12 -04:00