From da510d639001eda94bcbb1b3f330a6e8555851a9 Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Thu, 24 Oct 2024 14:41:01 +0100 Subject: [PATCH] Fix double free in case of test failure Signed-off-by: Paul Elliott --- .../tests/suites/test_suite_psa_crypto_memory.function | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 cc8784829..50539e87f 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 */