]> git.ipfire.org Git - thirdparty/git.git/commitdiff
refs/packed-backend.c: close fd of empty file
authorStefan Beller <sbeller@google.com>
Wed, 30 May 2018 17:03:00 +0000 (10:03 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 1 Jun 2018 01:49:53 +0000 (10:49 +0900)
Signed-off-by: Stefan Beller <sbeller@google.com>
Acked-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/packed-backend.c

index cec3fb9e00f78c1e0be9f24bd07aa756d56afc00..d447a731da0932e60c918030c7cd07a1843dfd35 100644 (file)
@@ -499,6 +499,7 @@ static int load_contents(struct snapshot *snapshot)
        size = xsize_t(st.st_size);
 
        if (!size) {
+               close(fd);
                return 0;
        } else if (mmap_strategy == MMAP_NONE || size <= SMALL_FILE_SIZE) {
                snapshot->buf = xmalloc(size);