Skip to content

Commit 4412e39

Browse files
author
Nir Sonnenschein
committed
fix resource leaks
1 parent 0d550ee commit 4412e39

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

components/TARGET_PSA/services/crypto/COMPONENT_SPE/psa_crypto_partition.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ static void psa_asymmetric_operation(void)
641641

642642
psa_write(msg.handle, 1,
643643
&signature_length, sizeof(signature_length));
644+
mbedtls_free(hash);
644645
mbedtls_free(signature);
645646
break;
646647
}
@@ -663,6 +664,7 @@ static void psa_asymmetric_operation(void)
663664
hash = mbedtls_calloc(1, msg.in_size[2]);
664665
if (hash == NULL) {
665666
status = PSA_ERROR_INSUFFICIENT_MEMORY;
667+
mbedtls_free(signature);
666668
break;
667669
}
668670

@@ -1636,6 +1638,8 @@ void psa_crypto_generator_operations(void)
16361638
label,
16371639
msg.in_size[2],//label length
16381640
psa_crypto_ipc.capacity);
1641+
mbedtls_free(label);
1642+
mbedtls_free(salt);
16391643

16401644
break;
16411645
}
@@ -1665,7 +1669,7 @@ void psa_crypto_generator_operations(void)
16651669
private_key,
16661670
msg.in_size[1],//private_key length
16671671
psa_crypto_ipc.alg);
1668-
1672+
mbedtls_free(private_key);
16691673
break;
16701674
}
16711675

0 commit comments

Comments
 (0)