diff --git a/components/TARGET_PSA/services/attestation/COMPONENT_SPE/psa_attestation_partition.c b/components/TARGET_PSA/services/attestation/COMPONENT_SPE/psa_attestation_partition.c index 1633637f58..c79e3cfe3f 100755 --- a/components/TARGET_PSA/services/attestation/COMPONENT_SPE/psa_attestation_partition.c +++ b/components/TARGET_PSA/services/attestation/COMPONENT_SPE/psa_attestation_partition.c @@ -205,6 +205,7 @@ static void psa_attest_inject_key(void) key_data, msg.in_size[1]); if (bytes_read != msg.in_size[1]) { free(public_key_data); + free(key_data); SPM_PANIC("SPM read length mismatch"); } }