summaryrefslogtreecommitdiff
path: root/mux.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2013-06-06 08:20:13 +1000
committerDarren Tucker <dtucker@zip.com.au>2013-06-06 08:20:13 +1000
commit746e9067bd9b3501876e1c86f38f3c510a12f895 (patch)
treecf5e9af122054c384b22c718b8a3de210856ea74 /mux.c
parentea64721275a81c4788af36294d94bf4f74012e06 (diff)
- dtucker@cvs.openbsd.org 2013/06/05 02:07:29
[mux.c] fix leaks in mux error paths, from Zhenbo Xu, found by Melton. bz#1967, ok djm
Diffstat (limited to 'mux.c')
-rw-r--r--mux.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/mux.c b/mux.c
index 31566be21..314ee8cd2 100644
--- a/mux.c
+++ b/mux.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mux.c,v 1.42 2013/06/02 23:36:29 dtucker Exp $ */ 1/* $OpenBSD: mux.c,v 1.43 2013/06/05 02:07:29 dtucker Exp $ */
2/* 2/*
3 * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -288,6 +288,7 @@ process_mux_master_hello(u_int rid, Channel *c, Buffer *m, Buffer *r)
288 288
289 if (name == NULL || value == NULL) { 289 if (name == NULL || value == NULL) {
290 free(name); 290 free(name);
291 free(value);
291 goto malf; 292 goto malf;
292 } 293 }
293 debug2("Unrecognised slave extension \"%s\"", name); 294 debug2("Unrecognised slave extension \"%s\"", name);
@@ -1427,7 +1428,9 @@ mux_client_read_packet(int fd, Buffer *m)
1427 buffer_init(&queue); 1428 buffer_init(&queue);
1428 if (mux_client_read(fd, &queue, 4) != 0) { 1429 if (mux_client_read(fd, &queue, 4) != 0) {
1429 if ((oerrno = errno) == EPIPE) 1430 if ((oerrno = errno) == EPIPE)
1430 debug3("%s: read header failed: %s", __func__, strerror(errno)); 1431 debug3("%s: read header failed: %s", __func__,
1432 strerror(errno));
1433 buffer_free(&queue);
1431 errno = oerrno; 1434 errno = oerrno;
1432 return -1; 1435 return -1;
1433 } 1436 }
@@ -1435,6 +1438,7 @@ mux_client_read_packet(int fd, Buffer *m)
1435 if (mux_client_read(fd, &queue, need) != 0) { 1438 if (mux_client_read(fd, &queue, need) != 0) {
1436 oerrno = errno; 1439 oerrno = errno;
1437 debug3("%s: read body failed: %s", __func__, strerror(errno)); 1440 debug3("%s: read body failed: %s", __func__, strerror(errno));
1441 buffer_free(&queue);
1438 errno = oerrno; 1442 errno = oerrno;
1439 return -1; 1443 return -1;
1440 } 1444 }