diff loginrec.c @ 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 83d85b28b353
children
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;
 		}
 	}