From: Pauli Date: Sun, 21 Mar 2021 22:37:56 +0000 (+1000) Subject: fix coverity 1466710: resource leak X-Git-Tag: openssl-3.0.0-alpha14~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09fba0b44032c2f66d5e7e8c732869e031ce74c8;p=thirdparty%2Fopenssl.git fix coverity 1466710: resource leak Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/14620) --- diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c index ed1b4122251..58283ca8f08 100644 --- a/providers/implementations/keymgmt/ec_kmgmt.c +++ b/providers/implementations/keymgmt/ec_kmgmt.c @@ -900,13 +900,13 @@ int ec_validate(const void *keydata, int selection, int checktype) if (!ossl_prov_is_running()) return 0; + if ((selection & EC_POSSIBLE_SELECTIONS) == 0) + return 1; /* nothing to validate */ + ctx = BN_CTX_new_ex(ossl_ec_key_get_libctx(eck)); if (ctx == NULL) return 0; - if ((selection & EC_POSSIBLE_SELECTIONS) == 0) - return 1; /* nothing to validate */ - if ((selection & OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS) != 0) { int flags = EC_KEY_get_flags(eck);