Commit dd59758d07 for openssl.org
commit dd59758d0739d54ae04b55d5faa6426b9c08b087
Author: yangxuqing <43904538+RigelYoung@users.noreply.github.com>
Date: Sat May 23 09:56:18 2026 +0800
slh_dsa: Remove redundant cleanup to prevent double free
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)
diff --git a/crypto/slh_dsa/slh_dsa_key.c b/crypto/slh_dsa/slh_dsa_key.c
index 2ac0b4d589..f99a00efb9 100644
--- a/crypto/slh_dsa/slh_dsa_key.c
+++ b/crypto/slh_dsa/slh_dsa_key.c
@@ -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;
}