]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test/ssl_old_test.c: Do NULL pointer check before its use
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Tue, 26 Oct 2021 02:40:20 +0000 (02:40 +0000)
committerTomas Mraz <tomas@openssl.org>
Wed, 27 Oct 2021 09:11:34 +0000 (11:11 +0200)
In openssl-3.0.0 and system provided, it is not reasonable to
check null pointer after use. The order was accidentally reversed.
Therefore, it is better to correct it.

CLA: trivial

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16915)

test/ssl_old_test.c

index 3ccc8e06e4c045658fe951aa2714ba340c6388a6..6a206d595e3691defda5e69b34875dcc82baee7b 100644 (file)
@@ -1896,9 +1896,9 @@ int doit_localhost(SSL *s_ssl, SSL *c_ssl, int family, long count,
     BIO_snprintf(addr_str, sizeof(addr_str), ":%s", BIO_get_accept_port(acpt));
 
     client = BIO_new_connect(addr_str);
-    BIO_set_conn_ip_family(client, family);
     if (!client)
         goto err;
+    BIO_set_conn_ip_family(client, family);
 
     if (BIO_set_nbio(client, 1) <= 0)
         goto err;