We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents d476d02 + 38b6e70 commit f9d3b0dCopy full SHA for f9d3b0d
src/fileops.c
@@ -304,15 +304,19 @@ int git_futils_mmap_ro_file(git_map *out, const char *path)
304
if (fd < 0)
305
return fd;
306
307
- if ((len = git_futils_filesize(fd)) < 0)
308
- return -1;
+ if ((len = git_futils_filesize(fd)) < 0) {
+ result = -1;
309
+ goto out;
310
+ }
311
312
if (!git__is_sizet(len)) {
313
giterr_set(GITERR_OS, "file `%s` too large to mmap", path);
314
315
316
}
317
318
result = git_futils_mmap_ro(out, fd, 0, (size_t)len);
319
+out:
320
p_close(fd);
321
return result;
322
0 commit comments