changeset 1513:c7675aa88880

loginrec close fd on error path
author Matt Johnston <matt@ucc.asn.au>
date Sat, 17 Feb 2018 12:16:18 +0800
parents 47f36d8565cf
children 6c16a05023aa
files loginrec.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/loginrec.c	Sat Feb 17 04:27:37 2018 +0100
+++ b/loginrec.c	Sat Feb 17 12:16:18 2018 +0800
@@ -1330,7 +1330,8 @@
 
 		if ( lseek(*fd, offset, SEEK_SET) != offset ) {
 			dropbear_log(LOG_WARNING, "lastlog_openseek: %s->lseek(): %s",
-			 lastlog_file, strerror(errno));
+				lastlog_file, strerror(errno));
+			m_close(*fd);
 			return 0;
 		}
 	}