Commit 013e1174df for openssl.org
commit 013e1174df1b3f8a51b393aaa22309dab66d371f
Author: lan1120 <lanming@huawei.com>
Date: Fri Dec 5 18:09:47 2025 +0800
Fix memory leak in abnormal branch of mlx_kem_dup function
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29318)
diff --git a/providers/implementations/keymgmt/mlx_kmgmt.c b/providers/implementations/keymgmt/mlx_kmgmt.c
index eb9c7a2aa4..b533468aaa 100644
--- a/providers/implementations/keymgmt/mlx_kmgmt.c
+++ b/providers/implementations/keymgmt/mlx_kmgmt.c
@@ -722,6 +722,7 @@ static void *mlx_kem_dup(const void *vkey, int selection)
if (ret->xkey == NULL)
return ret;
/* Fail if the source key is an inconsistent state */
+ OPENSSL_free(ret->propq);
OPENSSL_free(ret);
return NULL;
}