test_provider_ex(): Add missing call failure checks

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 https://github.com/openssl/openssl/pull/21913)
This commit is contained in:
Tomas Mraz 2023-08-31 10:26:22 +02:00 committed by Pauli
parent 79997a919f
commit 50b3c47b65
1 changed files with 8 additions and 5 deletions

View File

@ -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;
@ -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);