mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-30 05:54:23 +01:00
Fix ordering of free()ing of internal structures in ssl_server2
If `MBEDTLS_MEMORY_BUFFER_ALLOC_C` is configured and Mbed TLS' custom buffer allocator is used for calloc() and free(), the read buffer used by the server example application is allocated from the buffer allocator, but freed after the buffer allocator has been destroyed. If memory backtracing is enabled, this leaves a memory leak in the backtracing structure allocated for the buffer, as found by valgrind. Fixes #2069.
This commit is contained in:
parent
5bcbd4e7f4
commit
7c2f2f3266
@ -2495,6 +2495,8 @@ exit:
|
||||
mbedtls_ssl_cookie_free( &cookie_ctx );
|
||||
#endif
|
||||
|
||||
mbedtls_free( buf );
|
||||
|
||||
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
|
||||
#if defined(MBEDTLS_MEMORY_DEBUG)
|
||||
mbedtls_memory_buffer_alloc_status();
|
||||
@ -2502,7 +2504,6 @@ exit:
|
||||
mbedtls_memory_buffer_alloc_free();
|
||||
#endif
|
||||
|
||||
mbedtls_free( buf );
|
||||
mbedtls_printf( " done.\n" );
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
Loading…
Reference in New Issue
Block a user