]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
A null pointer dereference occurs when memory allocation fails
authoryangyangtiantianlonglong <yangtianlong1224@163.com>
Mon, 31 Jul 2023 14:04:41 +0000 (07:04 -0700)
committerHugo Landau <hlandau@openssl.org>
Wed, 2 Aug 2023 19:15:41 +0000 (20:15 +0100)
Fixes #21605

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21606)

ssl/ssl_sess.c

index cda6b7cc5bcfb69efc5a0ac9972fced5313937a4..2a5d21be79f6ec14f8e7f244360a4c355c6bc75c 100644 (file)
@@ -139,8 +139,11 @@ SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket)
     dest->references = 1;
 
     dest->lock = CRYPTO_THREAD_lock_new();
-    if (dest->lock == NULL)
+    if (dest->lock == NULL) {
+        OPENSSL_free(dest);
+        dest = NULL;
         goto err;
+    }
 
     if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, dest, &dest->ex_data))
         goto err;