From 69d45c9634312598b247320e7af351d0e396664f Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Wed, 5 Jun 2013 02:07:30 +0000 Subject: fix leaks in mux error paths, from Zhenbo Xu, found by Melton. bz#1967, ok djm --- usr.bin/ssh/mux.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/ssh/mux.c b/usr.bin/ssh/mux.c index bcaa4fdd790..4d62b72790e 100644 --- a/usr.bin/ssh/mux.c +++ b/usr.bin/ssh/mux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mux.c,v 1.42 2013/06/02 23:36:29 dtucker Exp $ */ +/* $OpenBSD: mux.c,v 1.43 2013/06/05 02:07:29 dtucker Exp $ */ /* * Copyright (c) 2002-2008 Damien Miller * @@ -275,6 +275,7 @@ process_mux_master_hello(u_int rid, Channel *c, Buffer *m, Buffer *r) if (name == NULL || value == NULL) { free(name); + free(value); goto malf; } debug2("Unrecognised slave extension \"%s\"", name); @@ -1407,7 +1408,9 @@ mux_client_read_packet(int fd, Buffer *m) buffer_init(&queue); if (mux_client_read(fd, &queue, 4) != 0) { if ((oerrno = errno) == EPIPE) - debug3("%s: read header failed: %s", __func__, strerror(errno)); + debug3("%s: read header failed: %s", __func__, + strerror(errno)); + buffer_free(&queue); errno = oerrno; return -1; } @@ -1415,6 +1418,7 @@ mux_client_read_packet(int fd, Buffer *m) if (mux_client_read(fd, &queue, need) != 0) { oerrno = errno; debug3("%s: read body failed: %s", __func__, strerror(errno)); + buffer_free(&queue); errno = oerrno; return -1; } -- cgit v1.2.3