diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-11-28 06:50:53 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-11-28 06:50:53 +0000 |
commit | 8ed09e4b021bd0584e36de9ccf8079298f62d199 (patch) | |
tree | 562231a8cfa4ba660b320b279cbdc52479b96276 | |
parent | a2799115027857ada12ebf34550ec2359896bb13 (diff) |
do not leak temp file if there is no known_hosts file
from craig leres, ok djm
-rw-r--r-- | usr.bin/ssh/ssh-keygen.c | 7 |
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); |