if the pxSSLContext memory is allocated we start doing the TLS operations.
If any of the TLS operation fails, we do the cleanup which involves sslContextFree( pxSSLContext );
The check for what memory to free in the sslContext attributes is done with comparison with 0.
But if the memory is not initialized before, random free can appear as the struct can hold already some data
My suggestion is if the memory has been allocated, do a memset(pxSSLContext , 0, sizeof( MbedSSLContext_t ))
In the transport_tls_socket_using_mbedtls.c in the function TLS_Socket_Connect we allocate memory for the ssl context.
if( ( pxSSLContext = pvPortMalloc( sizeof( MbedSSLContext_t ) ) ) == NULL )
if the pxSSLContext memory is allocated we start doing the TLS operations.
If any of the TLS operation fails, we do the cleanup which involves sslContextFree( pxSSLContext );
The check for what memory to free in the sslContext attributes is done with comparison with 0. But if the memory is not initialized before, random free can appear as the struct can hold already some data
My suggestion is if the memory has been allocated, do a memset(pxSSLContext , 0, sizeof( MbedSSLContext_t ))