]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Don't leak the OSSL_LIB_CTX in the event of a failure to load the FIPS module
authorMatt Caswell <matt@openssl.org>
Tue, 27 Jul 2021 15:31:20 +0000 (16:31 +0100)
committerPauli <pauli@openssl.org>
Wed, 28 Jul 2021 00:34:53 +0000 (10:34 +1000)
Ensure we free the OSSL_LIB_CTX on the error path.

Fixes #16163

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16168)

providers/fips/fipsprov.c

index 4155b6419748b6bf0ba086f8fc095e6a3f7f8e5b..b69299e04665b98accf83ff2d9167b2df093dc20 100644 (file)
@@ -712,6 +712,7 @@ int OSSL_provider_init_int(const OSSL_CORE_HANDLE *handle,
     return 1;
  err:
     fips_teardown(*provctx);
+    OSSL_LIB_CTX_free(libctx);
     *provctx = NULL;
     return 0;
 }