diff options
author | Pauli <pauli@openssl.org> | 2021-05-17 09:33:10 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-05-18 13:24:41 +1000 |
commit | 634da876e0d6d95a23c5d005b1ac4354a04310d2 (patch) | |
tree | 88973f60d457ff1202366ce588dcef5584f94bc6 /crypto | |
parent | cef71ebb5c757bafd15926dd6f6f2a2779b9d71a (diff) |
provider: fix coverity 1484884: uninitialised lock use
This actually fixes a more subtle problem that wasn't detected which could
cause memory leaks.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/15300)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/provider_core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/provider_core.c b/crypto/provider_core.c index b384f74fd2..9d5248de0d 100644 --- a/crypto/provider_core.c +++ b/crypto/provider_core.c @@ -306,7 +306,6 @@ static OSSL_PROVIDER *provider_new(const char *name, #ifndef HAVE_ATOMICS || (prov->refcnt_lock = CRYPTO_THREAD_lock_new()) == NULL #endif - || !ossl_provider_up_ref(prov) /* +1 One reference to be returned */ || (prov->opbits_lock = CRYPTO_THREAD_lock_new()) == NULL || (prov->flag_lock = CRYPTO_THREAD_lock_new()) == NULL || (prov->name = OPENSSL_strdup(name)) == NULL) { @@ -315,6 +314,7 @@ static OSSL_PROVIDER *provider_new(const char *name, return NULL; } + prov->refcnt = 1; /* 1 One reference to be returned */ prov->init_function = init_function; #ifndef FIPS_MODULE prov->flag_couldbechild = 1; |