]> 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:57 +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)

(cherry picked from commit 98be2e8fb60aaece2e4c3d42e87671fe22c081a2)

providers/implementations/keymgmt/ecx_kmgmt.c

index 987d38456fba41c973e8ce4e2adf60c1c4fc95f9..94e62f755c20de4885308a5a57125435f069f7d2 100644 (file)
@@ -487,7 +487,7 @@ static void *ecx_gen_init(void *provctx, int selection,
         gctx->selection = selection;
     }
     if (!ecx_gen_set_params(gctx, params)) {
-        OPENSSL_free(gctx);
+        ecx_gen_cleanup(gctx);
         gctx = NULL;
     }
     return gctx;