From a79d9d1be77708db9fe67b67e8fbd80a906b065e Mon Sep 17 00:00:00 2001 From: Nir Sonnenschein Date: Tue, 5 Mar 2019 15:03:56 +0200 Subject: [PATCH] fix resource leaks --- .../services/crypto/COMPONENT_SPE/psa_crypto_partition.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/TARGET_PSA/services/crypto/COMPONENT_SPE/psa_crypto_partition.c b/components/TARGET_PSA/services/crypto/COMPONENT_SPE/psa_crypto_partition.c index d0401fe52b..4bb8388731 100644 --- a/components/TARGET_PSA/services/crypto/COMPONENT_SPE/psa_crypto_partition.c +++ b/components/TARGET_PSA/services/crypto/COMPONENT_SPE/psa_crypto_partition.c @@ -641,6 +641,7 @@ static void psa_asymmetric_operation(void) psa_write(msg.handle, 1, &signature_length, sizeof(signature_length)); + mbedtls_free(hash); mbedtls_free(signature); break; } @@ -663,6 +664,7 @@ static void psa_asymmetric_operation(void) hash = mbedtls_calloc(1, msg.in_size[2]); if (hash == NULL) { status = PSA_ERROR_INSUFFICIENT_MEMORY; + mbedtls_free(signature); break; } @@ -1636,6 +1638,8 @@ void psa_crypto_generator_operations(void) label, msg.in_size[2],//label length psa_crypto_ipc.capacity); + mbedtls_free(label); + mbedtls_free(salt); break; } @@ -1665,7 +1669,7 @@ void psa_crypto_generator_operations(void) private_key, msg.in_size[1],//private_key length psa_crypto_ipc.alg); - + mbedtls_free(private_key); break; }