fix coverity 1466710: resource leak

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14620)
This commit is contained in:
Pauli 2021-03-22 08:37:56 +10:00 committed by Pauli
parent fd0a9ff7ef
commit 09fba0b440

View File

@ -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);