Skip to content

Commit

Permalink
test/provider_test.c: Add OSSL_PROVIDER_unload() to avoid memory leak
Browse files Browse the repository at this point in the history
Add OSSL_PROVIDER_unload() when OSSL_PROVIDER_add_builtin() fails to avoid memory leak.

Fixes: 5442611 ("Add a test for OSSL_LIB_CTX_new_child()")
Signed-off-by: Jiasheng Jiang <[email protected]>

Reviewed-by: Shane Lontis <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#25109)
  • Loading branch information
Jiasheng Jiang authored and t8m committed Aug 21, 2024
1 parent 6e8a103 commit 55662b6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions test/provider_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 55662b6

Please sign in to comment.