summaryrefslogtreecommitdiff
path: root/usr.bin/ssh
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2011-01-11 06:06:10 +0000
committerDamien Miller <djm@cvs.openbsd.org>2011-01-11 06:06:10 +0000
commitab3a46f537c68b0c13ea10848a4556ec30bd80cf (patch)
treee86c21e357e03ecb4ed9d1c88eb1fc891ed57e33 /usr.bin/ssh
parent7857258c3fd2c8204bbf0f53b205826d7051991d (diff)
fd leak on error paths; from zinovik@
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r--usr.bin/ssh/sshlogin.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/ssh/sshlogin.c b/usr.bin/ssh/sshlogin.c
index 361562b69e9..36756a963d8 100644
--- a/usr.bin/ssh/sshlogin.c
+++ b/usr.bin/ssh/sshlogin.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshlogin.c,v 1.26 2007/09/11 15:47:17 gilles Exp $ */
+/* $OpenBSD: sshlogin.c,v 1.27 2011/01/11 06:06:09 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -86,10 +86,12 @@ get_last_login_time(uid_t uid, const char *logname,
r = lseek(fd, pos, SEEK_SET);
if (r == -1) {
error("%s: lseek: %s", __func__, strerror(errno));
+ close(fd);
return (0);
}
if (r != pos) {
debug("%s: truncated lastlog", __func__);
+ close(fd);
return (0);
}
if (read(fd, &ll, sizeof(ll)) != sizeof(ll)) {