]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
fix coverity 1466710: resource leak
authorPauli <ppzgs1@gmail.com>
Sun, 21 Mar 2021 22:37:56 +0000 (08:37 +1000)
committerPauli <pauli@openssl.org>
Wed, 7 Apr 2021 22:49:27 +0000 (08:49 +1000)
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14620)

providers/implementations/keymgmt/ec_kmgmt.c

index ed1b41222516c04ba5d3291aec5d962569a2f900..58283ca8f081c9178a6f87b4f3b6bcf3de8baef1 100644 (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);