From 2282d5325a4ba9b3a5df39cc11485226b3d79b6a Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 23 Aug 2023 18:35:52 +1000 Subject: [PATCH] Only declare 'ex' if we will use it Fixes >>> CID 464851: Possible Control flow issues (DEADCODE) >>> Execution cannot reach this statement: "BN_free(ex);". Makes conditionals between declaring and use constistent. BN_free is not needed as BIGNUM's returned by RSA_get0_key are not to be freed. --- lib/dns/opensslrsa_link.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/dns/opensslrsa_link.c b/lib/dns/opensslrsa_link.c index d1546633b1..f1af259959 100644 --- a/lib/dns/opensslrsa_link.c +++ b/lib/dns/opensslrsa_link.c @@ -1105,14 +1105,13 @@ opensslrsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) { int i; #if OPENSSL_VERSION_NUMBER < 0x30000000L || OPENSSL_API_LEVEL < 30000 RSA *rsa = NULL, *pubrsa = NULL; - const BIGNUM *ex = NULL; #else OSSL_PARAM_BLD *bld = NULL; OSSL_PARAM *params = NULL; EVP_PKEY_CTX *ctx = NULL; - BIGNUM *ex = NULL; #endif /* OPENSSL_VERSION_NUMBER < 0x30000000L || OPENSSL_API_LEVEL < 30000 */ #if !defined(OPENSSL_NO_ENGINE) && OPENSSL_API_LEVEL < 30000 + const BIGNUM *ex = NULL; ENGINE *ep = NULL; #endif /* if !defined(OPENSSL_NO_ENGINE) && OPENSSL_API_LEVEL < 30000 */ isc_mem_t *mctx = key->mctx; @@ -1206,7 +1205,6 @@ opensslrsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) { DST_RET(ISC_R_SUCCESS); #else /* if !defined(OPENSSL_NO_ENGINE) && OPENSSL_API_LEVEL < 30000 */ UNUSED(engine); - UNUSED(ex); DST_RET(DST_R_NOENGINE); #endif /* if !defined(OPENSSL_NO_ENGINE) && OPENSSL_API_LEVEL < 30000 */ } @@ -1402,9 +1400,6 @@ err: if (bld != NULL) { OSSL_PARAM_BLD_free(bld); } - if (ex != NULL) { - BN_free(ex); - } if (e != NULL) { BN_free(e); }