Memory Leak and Hardfault at ecdh Handshake

Hello,
i tried a lot of things, and alligned the Buffer to 4 Bytes. Im using a STM32F7 with FreeRtos, LWIP and Mbed TLS. Even after updating i get an Hardfault after a long time. The Mbed TLS tries to free a pointer, which has not been allocated, causing a memory leak. Here is a picture of the current Frame Stack:
mbedtls_error

Reading this forum, i am not the only one having this problems. Anyone nows, what causes this?

Hi Tobias
Thank you for sharing information on your hardfault.

From the stack frame, I believe the crash happens when trying to free TB.
According to the code, this buffer should have been allocated, when copying the contents of B into TB through mbedtls_mpi_grow() (because TB->n is 0). You can see that the value of X == B is true because in fix_negative it is same big number that is being sent.

What is the implementation of custom_free()? Does it do anything in addition to regular C free?
How does your platform handle freeing NULL pointer? Will this cause a hardfault?
Regards,
Mbed TLS Support
Ron