diff --git a/tf-psa-crypto/tests/suites/test_suite_psa_crypto_memory.function b/tf-psa-crypto/tests/suites/test_suite_psa_crypto_memory.function index cc87848292..50539e87f0 100644 --- a/tf-psa-crypto/tests/suites/test_suite_psa_crypto_memory.function +++ b/tf-psa-crypto/tests/suites/test_suite_psa_crypto_memory.function @@ -107,7 +107,10 @@ void local_input_alloc(int input_len, psa_status_t exp_status) exit: mbedtls_free(local_input.buffer); - mbedtls_free(input); + + if (local_input.buffer != input) { + mbedtls_free(input); + } } /* END_CASE */