diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index 9b34a5d29a3..6a89af11377 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/ssh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.618 2025/09/15 04:50:42 djm Exp $ */ +/* $OpenBSD: ssh.c,v 1.619 2025/09/25 07:05:11 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -1708,8 +1708,6 @@ main(int ac, char **av) &timeout_ms, options.tcp_keep_alive) != 0) exit(255); - if (addrs != NULL) - freeaddrinfo(addrs); ssh_packet_set_timeout(ssh, options.server_alive_interval, options.server_alive_count_max); @@ -1850,9 +1848,13 @@ main(int ac, char **av) #endif skip_connect: + if (addrs != NULL) + freeaddrinfo(addrs); exit_status = ssh_session2(ssh, cinfo); ssh_conn_info_free(cinfo); - ssh_packet_close(ssh); + channel_free_channels(ssh); + ssh_packet_free(ssh); + pwfree(pw); if (options.control_path != NULL && muxserver_sock != -1) unlink(options.control_path);