]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix potential memory leak on failure of ecx_gen_init()
authorNiels Dossche <niels.dossche@ugent.be>
Wed, 20 Nov 2024 18:57:38 +0000 (19:57 +0100)
committerTomas Mraz <tomas@openssl.org>
Mon, 25 Nov 2024 14:18:26 +0000 (15:18 +0100)
When ecx_gen_set_params() returns 0, it could have duplicated the memory
for the parameter OSSL_KDF_PARAM_PROPERTIES already in gctx->propq,
leading to a memory leak.

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26015)

providers/implementations/keymgmt/ecx_kmgmt.c

index 5e9b80fc48ba8d7e55543a621ce2aef204facf93..b8d316ba8e9c8618009fcd93bfedb8d0923b099e 100644 (file)
@@ -510,7 +510,7 @@ static void *ecx_gen_init(void *provctx, int selection,
 #endif
     }
     if (!ecx_gen_set_params(gctx, params)) {
-        OPENSSL_free(gctx);
+        ecx_gen_cleanup(gctx);
         gctx = NULL;
     }
     return gctx;