test/provider_test.c: Add OSSL_PROVIDER_unload() to avoid memory leak
Add OSSL_PROVIDER_unload() when OSSL_PROVIDER_add_builtin() fails to avoid memory leak. Fixes: 5442611dff ("Add a test for OSSL_LIB_CTX_new_child()") Signed-off-by: Jiasheng Jiang <jiashengjiangcool@outlook.com> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/25109)
This commit is contained in:
parent
6e8a1031ed
commit
55662b6745
@ -255,6 +255,7 @@ static int test_builtin_provider_with_child(void)
|
||||
|
||||
if (!TEST_true(OSSL_PROVIDER_add_builtin(libctx, name,
|
||||
PROVIDER_INIT_FUNCTION_NAME))) {
|
||||
OSSL_PROVIDER_unload(legacy);
|
||||
OSSL_LIB_CTX_free(libctx);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user