From: Pauli Date: Fri, 19 Mar 2021 00:17:11 +0000 (+1000) Subject: rsa: fix coverity 1463571: explicit null dereference X-Git-Tag: openssl-3.0.0-alpha14~140 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=993237a8b678a888c05bc88d6c872be74696b768;p=thirdparty%2Fopenssl.git rsa: fix coverity 1463571: explicit null dereference Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/14618) --- diff --git a/providers/implementations/keymgmt/rsa_kmgmt.c b/providers/implementations/keymgmt/rsa_kmgmt.c index 394f3836dd7..eac38438849 100644 --- a/providers/implementations/keymgmt/rsa_kmgmt.c +++ b/providers/implementations/keymgmt/rsa_kmgmt.c @@ -435,16 +435,15 @@ static void *gen_init(void *provctx, int selection, int rsa_type, || !BN_set_word(gctx->pub_exp, RSA_F4)) { BN_free(gctx->pub_exp); OPENSSL_free(gctx); - gctx = NULL; - } else { - gctx->nbits = 2048; - gctx->primes = RSA_DEFAULT_PRIME_NUM; - gctx->rsa_type = rsa_type; + return NULL; } + gctx->nbits = 2048; + gctx->primes = RSA_DEFAULT_PRIME_NUM; + gctx->rsa_type = rsa_type; } if (!rsa_gen_set_params(gctx, params)) { OPENSSL_free(gctx); - gctx = NULL; + return NULL; } return gctx; }