]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
ossl_provider_new(): Fix memory leak on error
authorTomas Mraz <tomas@openssl.org>
Thu, 11 Apr 2024 07:27:47 +0000 (09:27 +0200)
committerTomas Mraz <tomas@openssl.org>
Fri, 12 Apr 2024 08:58:38 +0000 (10:58 +0200)
Fixes #24095

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24100)

crypto/provider_core.c

index 8046b0b48c5f5c5c6b138319f257657048137909..b0cb039705ceaf88688d9d4d492cf8b8720c684d 100644 (file)
@@ -564,8 +564,10 @@ OSSL_PROVIDER *ossl_provider_new(OSSL_LIB_CTX *libctx, const char *name,
             if (params[i].data_type != OSSL_PARAM_UTF8_STRING)
                 continue;
             if (ossl_provider_info_add_parameter(&template, params[i].key,
-                                                 (char *)params[i].data) <= 0)
+                                                 (char *)params[i].data) <= 0) {
+                sk_INFOPAIR_pop_free(template.parameters, infopair_free);
                 return NULL;
+            }
         }
     }