diff options
-rw-r--r-- | git/index/base.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/git/index/base.py b/git/index/base.py index d1f039cd..7cb77f15 100644 --- a/git/index/base.py +++ b/git/index/base.py @@ -135,7 +135,10 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): return None # END exception handling - stream = file_contents_ro(fd, stream=True, allow_mmap=True) + try: + stream = file_contents_ro(fd, stream=True, allow_mmap=True) + finally: + os.close(fd) self._deserialize(stream) else: |