From: Weidong Wang Date: Mon, 9 Mar 2026 10:19:11 +0000 (-0500) Subject: Fix memory leak in `EC_GROUP_copy()` X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=99ba983e28f07c6dc38538cd9bc71cd3e070f3c4;p=thirdparty%2Fopenssl.git Fix memory leak in `EC_GROUP_copy()` We must free pre_comp before its overwrite. Fixes: 3aef36ffef89 "Add CRYPTO_EX_DATA; remove EC_EXTRA_DATA" Reviewed-by: Eugene Syromiatnikov Reviewed-by: Paul Yang Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz MergeDate: Tue Mar 10 19:04:33 2026 (Merged from https://github.com/openssl/openssl/pull/30320) --- diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c index 01757f05883..0760944647b 100644 --- a/crypto/ec/ec_lib.c +++ b/crypto/ec/ec_lib.c @@ -175,6 +175,8 @@ int EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src) dest->libctx = src->libctx; dest->curve_name = src->curve_name; + EC_pre_comp_free(dest); + /* Copy precomputed */ dest->pre_comp_type = src->pre_comp_type; switch (src->pre_comp_type) {