Skip to content

Commit

Permalink
test_provider_ex(): Add missing call failure checks
Browse files Browse the repository at this point in the history
Fixes Coverity 1542440

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from #21913)
  • Loading branch information
t8m authored and paulidale committed Oct 8, 2023
1 parent 79997a9 commit 50b3c47
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/provider_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,15 @@ static int test_provider_ex(OSSL_LIB_CTX **libctx, const char *name)
int ok = 0;
long err;
const char custom_buf[] = "Custom greeting";
OSSL_PARAM_BLD *bld = OSSL_PARAM_BLD_new();
OSSL_PARAM_BLD *bld = NULL;
OSSL_PARAM *params = NULL;

OSSL_PARAM_BLD_push_utf8_string(bld, "greeting", custom_buf, strlen(custom_buf));
params = OSSL_PARAM_BLD_to_param(bld);

OSSL_PARAM_BLD_free(bld);
if (!TEST_ptr(bld = OSSL_PARAM_BLD_new())
|| !TEST_true(OSSL_PARAM_BLD_push_utf8_string(bld, "greeting", custom_buf,
strlen(custom_buf)))
|| !TEST_ptr(params = OSSL_PARAM_BLD_to_param(bld))) {
goto err;
}

if (!TEST_ptr(prov = OSSL_PROVIDER_load_ex(*libctx, name, params)))
goto err;
Expand Down Expand Up @@ -204,6 +206,7 @@ static int test_provider_ex(OSSL_LIB_CTX **libctx, const char *name)
ERR_print_errors_fp(stderr);
ok = 1;
err:
OSSL_PARAM_BLD_free(bld);
OSSL_PARAM_free(params);
OSSL_PROVIDER_unload(prov);
OSSL_LIB_CTX_free(*libctx);
Expand Down

0 comments on commit 50b3c47

Please sign in to comment.