Fix memory leak in some SE HAL tests

This commit is contained in:
Gilles Peskine 2019-10-21 15:57:51 +02:00
parent 581bfcfc96
commit ccfc5eaa81

View File

@ -565,16 +565,17 @@ static int check_persistent_data( psa_key_lifetime_t lifetime,
psa_storage_uid_t uid = file_uid_for_lifetime( lifetime ); psa_storage_uid_t uid = file_uid_for_lifetime( lifetime );
struct psa_storage_info_t info; struct psa_storage_info_t info;
uint8_t *loaded = NULL; uint8_t *loaded = NULL;
int ok = 0;
PSA_ASSERT( psa_its_get_info( uid, &info ) ); PSA_ASSERT( psa_its_get_info( uid, &info ) );
ASSERT_ALLOC( loaded, info.size ); ASSERT_ALLOC( loaded, info.size );
PSA_ASSERT( psa_its_get( uid, 0, info.size, loaded, NULL ) ); PSA_ASSERT( psa_its_get( uid, 0, info.size, loaded, NULL ) );
ASSERT_COMPARE( expected_data, size, loaded, info.size ); ASSERT_COMPARE( expected_data, size, loaded, info.size );
return( 1 ); ok = 1;
exit: exit:
mbedtls_free( loaded ); mbedtls_free( loaded );
return( 0 ); return( ok );
} }
/* Check that a function's return status is "smoke-free", i.e. that /* Check that a function's return status is "smoke-free", i.e. that