test_suite_ssl: prefer ASSERT_ALLOC over malloc

Fix formatting for option initialization
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
Andrzej Kurek 2022-07-04 05:20:55 -04:00
parent 2e1a232261
commit 3d0d501517

View File

@ -122,8 +122,10 @@ void init_handshake_options( handshake_test_options *opts )
opts->cli_log_fun = NULL; opts->cli_log_fun = NULL;
opts->resize_buffers = 1; opts->resize_buffers = 1;
#if defined(MBEDTLS_SSL_CACHE_C) #if defined(MBEDTLS_SSL_CACHE_C)
opts->cache = malloc( sizeof( mbedtls_ssl_cache_context ) ); ASSERT_ALLOC( opts->cache, sizeof( mbedtls_ssl_cache_context ) );
mbedtls_ssl_cache_init( opts->cache ); mbedtls_ssl_cache_init( opts->cache );
exit:
return;
#endif #endif
} }
@ -131,7 +133,7 @@ void free_handshake_options( handshake_test_options *opts )
{ {
#if defined(MBEDTLS_SSL_CACHE_C) #if defined(MBEDTLS_SSL_CACHE_C)
mbedtls_ssl_cache_free( opts->cache ); mbedtls_ssl_cache_free( opts->cache );
free( opts->cache ); mbedtls_free( opts->cache );
#else #else
(void) opts; (void) opts;
#endif #endif