]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: fix some one-off leaks in ssh.c; ok dtucker@
authordjm@openbsd.org <djm@openbsd.org>
Thu, 25 Sep 2025 07:05:11 +0000 (07:05 +0000)
committerDamien Miller <djm@mindrot.org>
Thu, 25 Sep 2025 07:07:30 +0000 (17:07 +1000)
OpenBSD-Commit-ID: bf3c27ffe4b3cccb6553b554ec4c04929065a2bc

ssh.c

diff --git a/ssh.c b/ssh.c
index f4524e384544c2a16ec83ecb3e7e6040782249f4..3b03108db156b51898aee76e7c7bb82a6d890298 100644 (file)
--- a/ssh.c
+++ b/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 <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1725,8 +1725,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);
@@ -1867,9 +1865,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);