diff options
author | Tomas Mraz <tomas@openssl.org> | 2024-07-18 11:01:00 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2024-07-31 11:23:45 +0200 |
commit | 6b6e5163a9300b5f32cd0bc98807e65b3acd4ae3 (patch) | |
tree | d7cae66362e86ddb1ee9725200b4af8f3cad80db | |
parent | 607e186d070df2bc8c5abafbc949e8ef568614bd (diff) | |
download | openssl-6b6e5163a9300b5f32cd0bc98807e65b3acd4ae3.zip openssl-6b6e5163a9300b5f32cd0bc98807e65b3acd4ae3.tar.gz openssl-6b6e5163a9300b5f32cd0bc98807e65b3acd4ae3.tar.bz2 |
Avoid leaking *ba_ret on reconnections
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)
-rw-r--r-- | apps/lib/s_socket.c | 3 | ||||
-rw-r--r-- | apps/s_client.c | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/apps/lib/s_socket.c b/apps/lib/s_socket.c index ace5168..e4068fa 100644 --- a/apps/lib/s_socket.c +++ b/apps/lib/s_socket.c @@ -90,9 +90,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; diff --git a/apps/s_client.c b/apps/s_client.c index 78a4475..6a124e0 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -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()); |