]> git.proxmox.com Git - libgit2.git/commit - src/util/futils.c
fileops: fix leaking fd in `mmap_ro_file`
authorPatrick Steinhardt <ps@pks.im>
Wed, 12 Apr 2017 06:09:08 +0000 (08:09 +0200)
committerPatrick Steinhardt <ps@pks.im>
Wed, 12 Apr 2017 06:09:08 +0000 (08:09 +0200)
commit38b6e700272b387aaa959a5d362467e8bcd836b4
tree0d33bd0e926d417e8bac0cb30d4baf594dc3c28d
parente572b63121dccf71054beeb62d4b18e618379049
fileops: fix leaking fd in `mmap_ro_file`

When the `git_futils_mmap_ro_file` function encounters an error after
the file has been opened, it will do a simple returns. Instead, we
should close the opened file descriptor to avoid a leak. This commit
fixes the issue.
src/fileops.c