mirror of
https://github.com/openssl/openssl.git
synced 2025-03-01 19:28:10 +08:00
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)
This commit is contained in:
parent
cef71ebb5c
commit
634da876e0
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user