diff options
author | Pauli <pauli@openssl.org> | 2021-11-11 06:49:49 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-11-12 19:53:54 +1000 |
commit | 648a15d6f5004f6f2ad88ea829adc7d29c638165 (patch) | |
tree | aac13d744938ff66772244f55f0c1d07fbae78d1 /crypto/provider_conf.c | |
parent | c37ff82e7c3993292fcc0524e5dde429fa3b65eb (diff) |
Add return value NULL checks that were missing
Issues located by Brian Carpenter of Geeknik's Farm.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17007)
(cherry picked from commit ed5b26ce0b34ec00bdd53d15854a22bccbb4d415)
Diffstat (limited to 'crypto/provider_conf.c')
-rw-r--r-- | crypto/provider_conf.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/crypto/provider_conf.c b/crypto/provider_conf.c index da3796d914..054261771a 100644 --- a/crypto/provider_conf.c +++ b/crypto/provider_conf.c @@ -146,9 +146,6 @@ static int provider_conf_load(OSSL_LIB_CTX *libctx, const char *name, const char *path = NULL; long activate = 0; int ok = 0; - PROVIDER_CONF_GLOBAL *pcgbl - = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_PROVIDER_CONF_INDEX, - &provider_conf_ossl_ctx_method); name = skip_dot(name); OSSL_TRACE1(CONF, "Configuring provider %s\n", name); @@ -185,7 +182,11 @@ static int provider_conf_load(OSSL_LIB_CTX *libctx, const char *name, } if (activate) { - if (!CRYPTO_THREAD_write_lock(pcgbl->lock)) { + PROVIDER_CONF_GLOBAL *pcgbl + = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_PROVIDER_CONF_INDEX, + &provider_conf_ossl_ctx_method); + + if (pcgbl == NULL || !CRYPTO_THREAD_write_lock(pcgbl->lock)) { ERR_raise(ERR_LIB_CRYPTO, ERR_R_INTERNAL_ERROR); return 0; } |