push: do not give big warning when no preference is configured
[gitweb.git] / refs.c
diff --git a/refs.c b/refs.c
index dffe395a97a12f2489dc5bbec1f822e3b8f08de5..e15880fbc836c8111799da3a4b6f32afe2604db9 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -1525,8 +1525,10 @@ int for_each_recent_reflog_ent(const char *ref, each_reflog_ent_fn fn, long ofs,
                if (fstat(fileno(logfp), &statbuf) ||
                    statbuf.st_size < ofs ||
                    fseek(logfp, -ofs, SEEK_END) ||
-                   fgets(buf, sizeof(buf), logfp))
+                   fgets(buf, sizeof(buf), logfp)) {
+                       fclose(logfp);
                        return -1;
+               }
        }
 
        while (fgets(buf, sizeof(buf), logfp)) {