summaryrefslogtreecommitdiffstats
path: root/crypto/provider_conf.c
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-11-11 06:49:49 +1000
committerPauli <pauli@openssl.org>2021-11-12 19:53:54 +1000
commit648a15d6f5004f6f2ad88ea829adc7d29c638165 (patch)
treeaac13d744938ff66772244f55f0c1d07fbae78d1 /crypto/provider_conf.c
parentc37ff82e7c3993292fcc0524e5dde429fa3b65eb (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.c9
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;
}