From 09fba0b44032c2f66d5e7e8c732869e031ce74c8 Mon Sep 17 00:00:00 2001 From: Pauli Date: Mon, 22 Mar 2021 08:37:56 +1000 Subject: [PATCH] fix coverity 1466710: resource leak Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/14620) --- providers/implementations/keymgmt/ec_kmgmt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c index ed1b412225..58283ca8f0 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);