]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
slh_dsa: Remove redundant cleanup to prevent double free
authoryangxuqing <43904538+RigelYoung@users.noreply.github.com>
Sat, 23 May 2026 01:56:18 +0000 (09:56 +0800)
committerTomas Mraz <tomas@openssl.foundation>
Fri, 29 May 2026 07:45:35 +0000 (09:45 +0200)
Since SLH_DSA_KEY is allocated with OPENSSL_zalloc, its members are
NULL-initialized. Removing the redundant slh_dsa_key_hash_cleanup()
inside the err path of slh_dsa_key_hash_init() prevents the
double free while allowing the outer ossl_slh_dsa_key_free() to
safely handle the cleanup.

CLA: trivial

Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Fri May 29 07:45:46 2026
(Merged from https://github.com/openssl/openssl/pull/31274)

crypto/slh_dsa/slh_dsa_key.c

index 2ac0b4d589e92cb4c511616ba15bc006b5cb6f48..f99a00efb975fe2f91e71a931d698b1a600933e4 100644 (file)
@@ -58,7 +58,6 @@ static int slh_dsa_key_hash_init(SLH_DSA_KEY *key)
     key->hash_func = ossl_slh_get_hash_fn(is_shake, security_category);
     return 1;
 err:
-    slh_dsa_key_hash_cleanup(key);
     return 0;
 }