From 1c9feebb44dfe3b628adf664ea4afc9b83e2dacd Mon Sep 17 00:00:00 2001 From: JiashengJiang Date: Fri, 16 May 2025 14:21:07 -0400 Subject: [PATCH] crypto/property/property.c: Free impl->method to avoid memory leak After ossl_method_up_ref() succeeds, impl_free() should be called to free impl->method. Fixes: 860ecfd ("property: check return values from the property locking calls.") Signed-off-by: JiashengJiang Reviewed-by: Matt Caswell Reviewed-by: Nicola Tuveri Reviewed-by: Richard Levitte Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/27564) (cherry picked from commit 00c531a5e327320f0ec78ce4b153fac65ebca229) --- crypto/property/property.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/property/property.c b/crypto/property/property.c index 55e990bdbf3..0d7bc6994ff 100644 --- a/crypto/property/property.c +++ b/crypto/property/property.c @@ -321,7 +321,7 @@ int ossl_method_store_add(OSSL_METHOD_STORE *store, const OSSL_PROVIDER *prov, /* Insert into the hash table if required */ if (!ossl_property_write_lock(store)) { - OPENSSL_free(impl); + impl_free(impl); return 0; } ossl_method_cache_flush(store, nid); -- 2.47.2