mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-05 09:40:32 +00:00
Fix memory leak in alternative code route
If no oid is found, and x509_attr_descr_from_numericoid returns NULL, previously the memory allocated for the oid wasn't freed. Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
This commit is contained in:
parent
f818e01edb
commit
39ba121d3a
@ -139,6 +139,8 @@ static const x509_attr_descriptor_t *x509_attr_descr_from_numericoid(const char
|
||||
|
||||
ret = mbedtls_oid_from_numeric_string(oid, numericoid, numericoid_len);
|
||||
if ((ret == MBEDTLS_ERR_X509_ALLOC_FAILED) || (ret == MBEDTLS_ERR_ASN1_INVALID_DATA)) {
|
||||
mbedtls_free(oid->p);
|
||||
mbedtls_free(oid);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user