Fix locking in ssl_cert_dup()
authorTodd Short <tshort@akamai.com>
Wed, 9 Mar 2016 15:01:43 +0000 (10:01 -0500)
committerRich Salz <rsalz@openssl.org>
Wed, 9 Mar 2016 16:26:01 +0000 (11:26 -0500)
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>
ssl/ssl_cert.c

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