Commit 24b2182c5a77945bedbc5de0f1b4a9b6f5d27284

Patrick Steinhardt 2016-11-15T12:53:53

sortedcache: plug leaked file descriptor

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/src/sortedcache.c b/src/sortedcache.c
index ed4199b..5bd989a 100644
--- a/src/sortedcache.c
+++ b/src/sortedcache.c
@@ -216,6 +216,7 @@ int git_sortedcache_lockandload(git_sortedcache *sc, git_buf *buf)
 	if (p_fstat(fd, &st) < 0) {
 		giterr_set(GITERR_OS, "failed to stat file");
 		error = -1;
+		(void)p_close(fd);
 		goto unlock;
 	}