]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
return NULL if gctx allocation fails.
authorBartel Artem <artem.bartel@gmail.com>
Wed, 11 Jun 2025 03:58:31 +0000 (06:58 +0300)
committerNeil Horman <nhorman@openssl.org>
Thu, 12 Jun 2025 12:33:31 +0000 (08:33 -0400)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27795)

providers/implementations/keymgmt/ecx_kmgmt.c

index dfa2e00621209814e7fb3f90335b1818cbf581fe..b3ff3bf097dbb3e0587bdd509f72a193c0753c15 100644 (file)
@@ -510,15 +510,15 @@ static void *ecx_gen_init(void *provctx, int selection,
         if (algdesc != NULL
                 && !ossl_FIPS_IND_callback(libctx, algdesc, "KeyGen Init")) {
             OPENSSL_free(gctx);
-            return 0;
+            return NULL;
         }
 #endif
+    } else {
+        return NULL;
     }
     if (!ecx_gen_set_params(gctx, params)) {
-        if (gctx != NULL) {
-            ecx_gen_cleanup(gctx);
-            gctx = NULL;
-        }
+        ecx_gen_cleanup(gctx);
+        gctx = NULL;
     }
     return gctx;
 }