mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-09-01 05:01:58 +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
@@ -3453,7 +3453,7 @@ psa_status_t psa_generate_key( psa_key_slot_t key,
|
||||
void mbedtls_psa_crypto_free( void )
|
||||
{
|
||||
psa_key_slot_t key;
|
||||
for( key = 1; key < PSA_KEY_SLOT_COUNT; key++ )
|
||||
for( key = 1; key <= PSA_KEY_SLOT_COUNT; key++ )
|
||||
psa_destroy_key( key );
|
||||
mbedtls_ctr_drbg_free( &global_data.ctr_drbg );
|
||||
mbedtls_entropy_free( &global_data.entropy );
|
||||
|
Reference in New Issue
Block a user