From 4ed9a38a906fff536193d1bf686bec15501df6e9 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 17 Jun 2025 10:53:58 -0400 Subject: [PATCH] Check setting of master key value MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Saša Nedvědický Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/27794) --- crypto/threads_common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crypto/threads_common.c b/crypto/threads_common.c index b47aae17f82..d5ef08413da 100644 --- a/crypto/threads_common.c +++ b/crypto/threads_common.c @@ -358,7 +358,10 @@ int CRYPTO_THREAD_set_local_ex(CRYPTO_THREAD_LOCAL_KEY_ID id, /* * make sure to assign it to our master key thread-local storage */ - CRYPTO_THREAD_set_local(&master_key, mkey); + if (!CRYPTO_THREAD_set_local(&master_key, mkey)) { + OPENSSL_free(mkey); + return 0; + } } /* -- 2.47.2