summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2022-04-26 11:04:49 +0200
committerRichard Levitte <levitte@openssl.org>2022-04-29 13:22:39 +0200
commit6c49fdde69fac71a0bc48299c126ca2b1f1e36a3 (patch)
treefa8a007bf9e669033742fbe20ffa001d447ca2fb
parente661cc45502e173a0d748c5310c13475546dbdf2 (diff)
Fix memleak in test/provider_test.c
This memory leak is triggered when configuring with 'no-legacy' Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/18179) (cherry picked from commit 49d874e0b7514cb270e817103ff0e13d4689e1f0)
-rw-r--r--test/provider_test.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/provider_test.c b/test/provider_test.c
index 807b8fcf22..11b7ee44a0 100644
--- a/test/provider_test.c
+++ b/test/provider_test.c
@@ -191,12 +191,15 @@ static int test_builtin_provider_with_child(void)
* In this case we assume we've been built with "no-legacy" and skip
* this test (there is no OPENSSL_NO_LEGACY)
*/
+ OSSL_LIB_CTX_free(libctx);
return 1;
}
if (!TEST_true(OSSL_PROVIDER_add_builtin(libctx, name,
- PROVIDER_INIT_FUNCTION_NAME)))
+ PROVIDER_INIT_FUNCTION_NAME))) {
+ OSSL_LIB_CTX_free(libctx);
return 0;
+ }
/* test_provider will free libctx and unload legacy as part of the test */
return test_provider(&libctx, name, legacy);