summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauli <ppzgs1@gmail.com>2021-03-22 09:05:40 +1000
committerPauli <pauli@openssl.org>2021-03-24 09:40:26 +1000
commit218e1263c4f2ac014859bcd6b72d0e66a3f75d95 (patch)
treeeebedd0bd6f446fecac205712fa14134dd3de703
parent9d8c53ed164f325a28bee657b09cf4b30d62a08f (diff)
ec_keymgmt: fix coverity 1474427: resource leak
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14637)
-rw-r--r--providers/implementations/keymgmt/ec_kmgmt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c
index 2ba21dfb39..b8aa518a08 100644
--- a/providers/implementations/keymgmt/ec_kmgmt.c
+++ b/providers/implementations/keymgmt/ec_kmgmt.c
@@ -847,13 +847,13 @@ int sm2_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)
ok = ok && EC_GROUP_check(EC_KEY_get0_group(eck), ctx);