]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
crypto/property/property.c: Free impl->method to avoid memory leak
authorJiashengJiang <jiasheng@purdue.edu>
Fri, 16 May 2025 18:21:07 +0000 (14:21 -0400)
committerTomas Mraz <tomas@openssl.org>
Thu, 29 May 2025 14:40:49 +0000 (16:40 +0200)
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)

(cherry picked from commit 00c531a5e327320f0ec78ce4b153fac65ebca229)

crypto/property/property.c

index 75615d39af3664b5a62ba7bc7d7643926aa1c87a..722d7fdcf7cb1e4fd851dca28bb670fe727a9747 100644 (file)
@@ -329,7 +329,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);