LwIP Assertion Failed: "mem_free: illegal memory: non-linked: double free"
Hi ST Community,
I am working on a project using the STM32H723 MCU and the KSZ8863 Ethernet switch. I initially encountered issues while using a modified TCP echo server example, but after reverting to the unmodified example, the same issue persists. Communication is functional, but the system eventually crashes with the following assertion:
Assertion "mem_free: illegal memory: non-linked: double free" failed at line 661 in ../Middlewares/Third_Party/LwIP/src/core/mem.c
System Details:
- MCU: STM32H723
- Switch: KSZ8863 (connected via RMII for Ethernet data and SPI for control)
- Middleware: LwIP (as provided in STM32Cube firmware package)
- Example Used: Modified tcpecho server example from LwIP.
- Peripheral Interface:
- RMII for Ethernet data.
- SPI for KSZ8863 switch configuration.
- SMI is not used.
Observed Behavior:
- The application works correctly for some time, and the TCP echo functionality responds as expected.
- Under moderate network load or over time, the system crashes with the above assertion in LwIP’s mem_free function.
Here are the configurations:
Cortex M7:

Ethernet:

LwIP:



Thanks in advance for any guidance!
Best regards,
Russel Mahmud
