summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-01-18 21:49:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-01-18 21:49:56 (GMT)
commit2c0a645d9e1f7442d17a9666e57d6e72b09bb51b (patch)
treee4ef4146bea646eecdc66fe0794f0a6f0f4c9431
parenteb8638abec6a5f9dc733b8032e1fd6863507b364 (diff)
parent6881925ef5a0a8b1a33e2f4ceec2ce7ad007dc7a (diff)
downloadgit-2c0a645d9e1f7442d17a9666e57d6e72b09bb51b.zip
git-2c0a645d9e1f7442d17a9666e57d6e72b09bb51b.tar.gz
git-2c0a645d9e1f7442d17a9666e57d6e72b09bb51b.tar.bz2
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()
-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);