]> 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:32 +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 55e990bdbf3c103e229db729061b925e89c9fed0..0d7bc6994ff06803513e2e51cf5b20b66865cc53 100644 (file)
@@ -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);