]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix a potential memory leak in crypto/provider_child.c
authorRuili Fang <ruili.fang.98@gmail.com>
Sun, 29 Jan 2023 04:48:24 +0000 (23:48 -0500)
committerPauli <pauli@openssl.org>
Tue, 31 Jan 2023 21:20:08 +0000 (08:20 +1100)
Fix issue #20063.
CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20163)

crypto/provider_child.c

index b1eadd5b19a8260b0760fb5d79364438282e157a..176a3a5cb25d954b465aa79c31bbf496d0a3b2ba 100644 (file)
@@ -135,8 +135,10 @@ static int provider_create_child_cb(const OSSL_CORE_HANDLE *prov, void *cbdata)
                                        1)) == NULL)
             goto err;
 
-        if (!ossl_provider_activate(cprov, 0, 0))
+        if (!ossl_provider_activate(cprov, 0, 0)) {
+            ossl_provider_free(cprov);
             goto err;
+        }
 
         if (!ossl_provider_set_child(cprov, prov)
             || !ossl_provider_add_to_store(cprov, NULL, 0)) {