Fix locking in ssl_cert_dup()

Properly check the return value of CRYPTO_THREAD_lock_new()

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
This commit is contained in:
Todd Short 2016-03-09 10:01:43 -05:00 committed by Rich Salz
parent b7aacc3ac3
commit aeb5b95576

View File

@ -190,7 +190,7 @@ CERT *ssl_cert_dup(CERT *cert)
ret->references = 1; ret->references = 1;
ret->key = &ret->pkeys[cert->key - cert->pkeys]; ret->key = &ret->pkeys[cert->key - cert->pkeys];
ret->lock = CRYPTO_THREAD_lock_new(); ret->lock = CRYPTO_THREAD_lock_new();
if (ret == NULL) { if (ret->lock == NULL) {
SSLerr(SSL_F_SSL_CERT_DUP, ERR_R_MALLOC_FAILURE); SSLerr(SSL_F_SSL_CERT_DUP, ERR_R_MALLOC_FAILURE);
OPENSSL_free(ret); OPENSSL_free(ret);
return NULL; return NULL;