Skip to content

Commit 2c0a645

Browse files
committed
Merge branch 'rs/sha1-file-close-mapped-file-on-error'
Code clean-up. * rs/sha1-file-close-mapped-file-on-error: sha1-file: close fd of empty file in map_sha1_file_1()
2 parents eb8638a + 6881925 commit 2c0a645

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

sha1-file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,7 @@ static void *map_sha1_file_1(struct repository *r, const char *path,
960960
if (!*size) {
961961
/* mmap() is forbidden on empty files */
962962
error(_("object file %s is empty"), path);
963+
close(fd);
963964
return NULL;
964965
}
965966
map = xmmap(NULL, *size, PROT_READ, MAP_PRIVATE, fd, 0);

0 commit comments

Comments
 (0)