summaryrefslogtreecommitdiff
path: root/usr.bin/ssh
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2015-03-24 20:10:09 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2015-03-24 20:10:09 +0000
commite79f4bbab03b3798c76532b2702af9fda4a39291 (patch)
tree0b0dba48469c6197e5347902311e9597a709c4ab /usr.bin/ssh
parent0189605cb0ca628814c4ca98c67c66c8eb06c1a7 (diff)
don't leak 'setp' on error; noted by Nicholas Lemonias; ok djm@
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r--usr.bin/ssh/packet.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/usr.bin/ssh/packet.c b/usr.bin/ssh/packet.c
index 297175487e6..6d5e2a7b510 100644
--- a/usr.bin/ssh/packet.c
+++ b/usr.bin/ssh/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.209 2015/03/11 00:48:39 jsg Exp $ */
+/* $OpenBSD: packet.c,v 1.210 2015/03/24 20:10:08 markus Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1268,10 +1268,8 @@ ssh_packet_read_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
* Since we are blocking, ensure that all written packets have
* been sent.
*/
- if ((r = ssh_packet_write_wait(ssh)) != 0) {
- free(setp);
- return r;
- }
+ if ((r = ssh_packet_write_wait(ssh)) != 0)
+ goto out;
/* Stay in the loop until we have received a complete packet. */
for (;;) {
@@ -1328,15 +1326,20 @@ ssh_packet_read_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
len = roaming_read(state->connection_in, buf,
sizeof(buf), &cont);
} while (len == 0 && cont);
- if (len == 0)
- return SSH_ERR_CONN_CLOSED;
- if (len < 0)
- return SSH_ERR_SYSTEM_ERROR;
+ if (len == 0) {
+ r = SSH_ERR_CONN_CLOSED;
+ goto out;
+ }
+ if (len < 0) {
+ r = SSH_ERR_SYSTEM_ERROR;
+ goto out;
+ }
/* Append it to the buffer. */
if ((r = ssh_packet_process_incoming(ssh, buf, len)) != 0)
- return r;
+ goto out;
}
+ out:
free(setp);
return r;
}