ssl_client2: move memory leak check before rng_free()

Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
Przemyslaw Stekiel 2021-11-03 14:19:52 +01:00
parent b66bc0ad4a
commit e9dea7c3b0

View File

@ -3031,6 +3031,10 @@ exit:
#endif /* MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED &&
MBEDTLS_USE_PSA_CRYPTO */
mbedtls_ssl_session_free( &saved_session );
mbedtls_ssl_free( &ssl );
mbedtls_ssl_config_free( &conf );
#if defined(MBEDTLS_USE_PSA_CRYPTO)
const char* message = mbedtls_test_helper_is_psa_leaking();
if( message )
@ -3048,9 +3052,6 @@ exit:
mbedtls_psa_crypto_free( );
#endif
mbedtls_ssl_session_free( &saved_session );
mbedtls_ssl_free( &ssl );
mbedtls_ssl_config_free( &conf );
rng_free( &rng );
if( session_data != NULL )
mbedtls_platform_zeroize( session_data, session_data_len );