mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-09 10:14:11 +00:00
Free allocated memory where methods were returning without freeing
Signed-off-by: Sam Berry <sam.berry@arm.com> Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
This commit is contained in:
parent
1e6ed524c2
commit
c2ec6fa25b
@ -197,15 +197,13 @@ psa_status_t mbedtls_psa_rsa_export_public_key(
|
||||
|
||||
status = mbedtls_psa_rsa_load_representation(
|
||||
attributes->type, key_buffer, key_buffer_size, &rsa);
|
||||
if (status != PSA_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
||||
if (status == PSA_SUCCESS) {
|
||||
status = mbedtls_psa_rsa_export_key(PSA_KEY_TYPE_RSA_PUBLIC_KEY,
|
||||
rsa,
|
||||
data,
|
||||
data_size,
|
||||
data_length);
|
||||
}
|
||||
|
||||
mbedtls_rsa_free(rsa);
|
||||
mbedtls_free(rsa);
|
||||
@ -264,6 +262,7 @@ psa_status_t mbedtls_psa_rsa_generate_key(
|
||||
(unsigned int) attributes->bits,
|
||||
exponent);
|
||||
if (ret != 0) {
|
||||
mbedtls_rsa_free(&rsa);
|
||||
return mbedtls_to_psa_error(ret);
|
||||
}
|
||||
|
||||
@ -330,7 +329,7 @@ psa_status_t mbedtls_psa_rsa_sign_hash(
|
||||
key_buffer_size,
|
||||
&rsa);
|
||||
if (status != PSA_SUCCESS) {
|
||||
return status;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
status = psa_rsa_decode_md_type(alg, hash_length, &md_alg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user