mirror of
https://github.com/openssl/openssl.git
synced 2025-01-24 13:55:42 +08:00
Fix memory leak in ossl_rsa_fromdata.
Occurs if a malloc failure happens inside collect_numbers() Reported via #18365 Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18646)
This commit is contained in:
parent
995eccb611
commit
28adea9597
@ -49,9 +49,12 @@ static int collect_numbers(STACK_OF(BIGNUM) *numbers,
|
||||
if (p != NULL) {
|
||||
BIGNUM *tmp = NULL;
|
||||
|
||||
if (!OSSL_PARAM_get_BN(p, &tmp)
|
||||
|| sk_BIGNUM_push(numbers, tmp) == 0)
|
||||
if (!OSSL_PARAM_get_BN(p, &tmp))
|
||||
return 0;
|
||||
if (sk_BIGNUM_push(numbers, tmp) == 0) {
|
||||
BN_clear_free(tmp);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user