diff options
author | Tomas Mraz <tomas@openssl.org> | 2023-08-31 10:26:22 +0200 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2023-10-09 10:21:19 +1100 |
commit | 50b3c47b65e47a4f52ed1c47a0f248beb890193e (patch) | |
tree | 5b9b84d768770cc3ec9e6d99a7004d2276e108ee | |
parent | 79997a919f6cf3823d04fa9b34adaaa5aadd871a (diff) |
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)
-rw-r--r-- | test/provider_test.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/test/provider_test.c b/test/provider_test.c index 3268a287a2..2d20d12071 100644 --- a/test/provider_test.c +++ b/test/provider_test.c @@ -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); |