Commit 00c531a5e3 for openssl.org
commit 00c531a5e327320f0ec78ce4b153fac65ebca229
Author: JiashengJiang <jiasheng@purdue.edu>
Date: Fri May 16 14:21:07 2025 -0400
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 <jiasheng@purdue.edu>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27564)
diff --git a/crypto/property/property.c b/crypto/property/property.c
index 2c35222f76..4141c17603 100644
--- a/crypto/property/property.c
+++ b/crypto/property/property.c
@@ -348,7 +348,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;
}