summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2015-02-25 19:54:02 +0000
committerDamien Miller <djm@mindrot.org>2015-02-26 10:09:58 +1100
commita63cfa26864b93ab6afefad0b630e5358ed8edfa (patch)
tree4abdd9622e5ef4128563ba04ac37511b1e03f92f
parente6b950341dd75baa8526f1862bca39e52f5b879b (diff)
upstream commit
fix small memory leak when UpdateHostkeys=no
-rw-r--r--clientloop.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/clientloop.c b/clientloop.c
index 8969869b..a9c8a90f 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clientloop.c,v 1.271 2015/02/23 16:33:25 djm Exp $ */
+/* $OpenBSD: clientloop.c,v 1.272 2015/02/25 19:54:02 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -2321,9 +2321,7 @@ client_input_hostkeys(void)
char *fp;
static int hostkeys_seen = 0; /* XXX use struct ssh */
extern struct sockaddr_storage hostaddr; /* XXX from ssh.c */
- struct hostkeys_update_ctx *ctx;
-
- ctx = xcalloc(1, sizeof(*ctx));
+ struct hostkeys_update_ctx *ctx = NULL;
if (hostkeys_seen)
fatal("%s: server already sent hostkeys", __func__);
@@ -2332,6 +2330,8 @@ client_input_hostkeys(void)
return 1; /* won't ask in batchmode, so don't even try */
if (!options.update_hostkeys || options.num_user_hostfiles <= 0)
return 1;
+
+ ctx = xcalloc(1, sizeof(*ctx));
while (ssh_packet_remaining(ssh) > 0) {
sshkey_free(key);
key = NULL;