summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2015-02-09 23:22:37 +0000
committerjsg <jsg@openbsd.org>2015-02-09 23:22:37 +0000
commitd230b5447e20f4c6603a4129ce8a2074585afdde (patch)
tree799b00f0fbd762312c9417b48689e09e2138d07c
parentMerge clock-mode command into copy-mode. (diff)
downloadwireguard-openbsd-d230b5447e20f4c6603a4129ce8a2074585afdde.tar.xz
wireguard-openbsd-d230b5447e20f4c6603a4129ce8a2074585afdde.zip
fix some leaks in error paths
ok markus@
-rw-r--r--usr.bin/ssh/packet.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/ssh/packet.c b/usr.bin/ssh/packet.c
index 90403f0187b..e0100e9aedd 100644
--- a/usr.bin/ssh/packet.c
+++ b/usr.bin/ssh/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.205 2015/01/30 01:13:33 djm Exp $ */
+/* $OpenBSD: packet.c,v 1.206 2015/02/09 23:22:37 jsg Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -284,6 +284,7 @@ ssh_packet_set_connection(struct ssh *ssh, int fd_in, int fd_out)
(r = cipher_init(&state->receive_context, none,
(const u_char *)"", 0, NULL, 0, CIPHER_DECRYPT)) != 0) {
error("%s: cipher_init failed: %s", __func__, ssh_err(r));
+ free(ssh);
return NULL;
}
state->newkeys[MODE_IN] = state->newkeys[MODE_OUT] = NULL;
@@ -1262,8 +1263,10 @@ 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)
+ if ((r = ssh_packet_write_wait(ssh)) != 0) {
+ free(setp);
return r;
+ }
/* Stay in the loop until we have received a complete packet. */
for (;;) {