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> |
||
|---|---|---|
| .. | ||
| device | ||
| CMakeLists.txt | ||
| Kconfig | ||