summaryrefslogtreecommitdiff
path: root/sha1-file.c
diff options
context:
space:
mode:
Diffstat (limited to 'sha1-file.c')
-rw-r--r--sha1-file.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sha1-file.c b/sha1-file.c
index efcb2cb..386b96e 100644
--- a/sha1-file.c
+++ b/sha1-file.c
@@ -960,6 +960,7 @@ static void *map_sha1_file_1(struct repository *r, const char *path,
if (!*size) {
/* mmap() is forbidden on empty files */
error(_("object file %s is empty"), path);
+ close(fd);
return NULL;
}
map = xmmap(NULL, *size, PROT_READ, MAP_PRIVATE, fd, 0);