Skip to content

Commit 09427e8

Browse files
stefanbellergitster
authored andcommitted
refs/packed-backend.c: close fd of empty file
Signed-off-by: Stefan Beller <[email protected]> Acked-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2161ed8 commit 09427e8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

refs/packed-backend.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ static int load_contents(struct snapshot *snapshot)
499499
size = xsize_t(st.st_size);
500500

501501
if (!size) {
502+
close(fd);
502503
return 0;
503504
} else if (mmap_strategy == MMAP_NONE || size <= SMALL_FILE_SIZE) {
504505
snapshot->buf = xmalloc(size);

0 commit comments

Comments
 (0)