]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Avoid leaking *ba_ret on reconnections
authorTomas Mraz <tomas@openssl.org>
Thu, 18 Jul 2024 09:01:00 +0000 (11:01 +0200)
committerTomas Mraz <tomas@openssl.org>
Wed, 31 Jul 2024 09:23:38 +0000 (11:23 +0200)
Also fixes Coverity 1604639
There is no point in checking ba_ret as it can never be NULL.

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/24931)

(cherry picked from commit 4fa9d1f40fc85d8c70c93168dc812217db349359)

apps/lib/s_socket.c
apps/s_client.c

index 24e79425695f1ab827d2d04914d1f9e24ba11753..f7454053cfea4c4fd7bd1dcc5f3165f0fb40df66 100644 (file)
@@ -84,9 +84,6 @@ int init_client(int *sock, const char *host, const char *port,
     int ret;
     int options = 0;
 
-    if (tfo && ba_ret != NULL)
-        *ba_ret = NULL;
-
     if (BIO_sock_init() != 1)
         return 0;
 
index 78a44755cb54fbe7f14eae756c8aee415263de96..6a124e0a19a3aff0b214b590d1924bff60751ff9 100644 (file)
@@ -2167,6 +2167,9 @@ int s_client_main(int argc, char **argv)
     if (tfo)
         BIO_printf(bio_c_out, "Connecting via TFO\n");
  re_start:
+    /* peer_addr might be set from previous connections */
+    BIO_ADDR_free(peer_addr);
+    peer_addr = NULL;
     if (init_client(&sock, host, port, bindhost, bindport, socket_family,
                     socket_type, protocol, tfo, !isquic, &peer_addr) == 0) {
         BIO_printf(bio_err, "connect:errno=%d\n", get_last_socket_error());