]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: fix memory leak in mux_client_request_stdio_fwd GHPR#575
authordjm@openbsd.org <djm@openbsd.org>
Tue, 30 Sep 2025 00:03:09 +0000 (00:03 +0000)
committerDamien Miller <djm@mindrot.org>
Tue, 30 Sep 2025 00:08:17 +0000 (10:08 +1000)
by Boris Tonofa; ok dtucker

OpenBSD-Commit-ID: 410cdd05242304bd0196b9172ce5fcaf89d2d8ce

mux.c

diff --git a/mux.c b/mux.c
index 7dd1309faf728ff027c0bcca76dda102b9881e9b..37bcb91037ef99fc27f8732a26dfc35a9978e5c6 100644 (file)
--- a/mux.c
+++ b/mux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mux.c,v 1.106 2025/09/15 04:48:29 djm Exp $ */
+/* $OpenBSD: mux.c,v 1.107 2025/09/30 00:03:09 djm Exp $ */
 /*
  * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
  *
@@ -2195,8 +2195,10 @@ mux_client_request_stdio_fwd(int fd)
        sshbuf_reset(m);
        if (mux_client_read_packet(fd, m) != 0) {
                if (errno == EPIPE ||
-                   (errno == EINTR && muxclient_terminate != 0))
+                   (errno == EINTR && muxclient_terminate != 0)) {
+                       sshbuf_free(m);
                        return 0;
+               }
                fatal_f("mux_client_read_packet: %s", strerror(errno));
        }
        fatal_f("master returned unexpected message %u", type);