summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/ssh-keygen.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-11-28 06:50:52 +0000
committerderaadt <deraadt@openbsd.org>2015-11-28 06:50:52 +0000
commit8039898ba7a90dd519f9a64983d070e68191ea54 (patch)
tree55fc913a2f7a169585936608800312e922d2dc94 /usr.bin/ssh/ssh-keygen.c
parentdon't include port number in tcpip-forward replies for requests (diff)
downloadwireguard-openbsd-8039898ba7a90dd519f9a64983d070e68191ea54.tar.xz
wireguard-openbsd-8039898ba7a90dd519f9a64983d070e68191ea54.zip
do not leak temp file if there is no known_hosts file
from craig leres, ok djm
Diffstat (limited to 'usr.bin/ssh/ssh-keygen.c')
-rw-r--r--usr.bin/ssh/ssh-keygen.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/ssh/ssh-keygen.c b/usr.bin/ssh/ssh-keygen.c
index 62bde5a8915..6fa44239225 100644
--- a/usr.bin/ssh/ssh-keygen.c
+++ b/usr.bin/ssh/ssh-keygen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keygen.c,v 1.283 2015/11/20 23:04:01 halex Exp $ */
+/* $OpenBSD: ssh-keygen.c,v 1.284 2015/11/28 06:50:52 deraadt Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1216,8 +1216,11 @@ do_known_hosts(struct passwd *pw, const char *name)
foreach_options |= print_fingerprint ? HKF_WANT_PARSE_KEY : 0;
if ((r = hostkeys_foreach(identity_file,
hash_hosts ? known_hosts_hash : known_hosts_find_delete, &ctx,
- name, NULL, foreach_options)) != 0)
+ name, NULL, foreach_options)) != 0) {
+ if (inplace)
+ unlink(tmp);
fatal("%s: hostkeys_foreach failed: %s", __func__, ssh_err(r));
+ }
if (inplace)
fclose(ctx.out);