mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-01 10:06:53 +03:00
psa_crypto_free: destroy the last slot
The last slot in the array was not freed due to an off-by-one error. Amend the fill_slots test to serve as a non-regression test for this issue: without this bug fix, it would cause a memory leak.
This commit is contained in:
committed by
Jaeden Amero
parent
996deb18cc
commit
9a05634558
@ -496,12 +496,10 @@ void fill_slots( int max_arg )
|
||||
&exported_size ) == PSA_SUCCESS );
|
||||
TEST_ASSERT( exported_size == sizeof( slot ) );
|
||||
TEST_ASSERT( memcmp( exported, &slot, sizeof( slot ) ) == 0 );
|
||||
TEST_ASSERT( psa_destroy_key( slot ) == PSA_SUCCESS );
|
||||
}
|
||||
|
||||
exit:
|
||||
for( slot = 1; slot <= max; slot++ )
|
||||
psa_destroy_key( slot );
|
||||
/* Do not destroy the keys. mbedtls_psa_crypto_free() should do it. */
|
||||
mbedtls_psa_crypto_free( );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
Reference in New Issue
Block a user