Commit Diff


commit - e896de0dbd9971fbc7969f0df170b4a495b4cd28
commit + 06b40487cb45b7d4def06fb83471662497e35879
blob - 90462626d8b4280e7a38aa3e03f64545013c53f6
blob + b867d92de385084a47936eb776de4a60ca921c58
--- lib/reference.c
+++ lib/reference.c
@@ -206,6 +206,8 @@ parse_ref_file(struct got_reference **ref, const char 
 	}
 	if (fstat(fileno(f), &sb) == -1) {
 		err = got_error_from_errno2("fstat", abspath);
+		if (lock)
+			got_lockfile_unlock(lf, -1);
 		goto done;
 	}
 	if (!S_ISREG(sb.st_mode)) {