]> 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:53:11 +0000 (08:53 -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)

(cherry picked from commit 443298e0f0e2c8225f8c6d6fdc01c6c4d434028b)

providers/implementations/keymgmt/ecx_kmgmt.c

index 642f42a2da376e338e26d490d7c2d37ea945ad3c..96813ad8cfe29e0182647c2fe7f6cd828d46221c 100644 (file)
@@ -487,12 +487,12 @@ static void *ecx_gen_init(void *provctx, int selection,
         gctx->libctx = libctx;
         gctx->type = type;
         gctx->selection = selection;
+    } 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;
 }