diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2016-11-15 11:24:24 +0100 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2016-11-15 11:24:24 +0100 |
commit | 66cfb039ce7127f853ef7b7791e91679065edd87 (patch) | |
tree | 19634778ef8fa07bcb03075c8ebab68ce099b151 | |
parent | f5ea9d4a5fca10089e79cf6149364f5013304192 (diff) | |
download | libgit2-cmn/sortedcache-close.tar.gz |
sortedcache: close the fd on stat trouble as wellcmn/sortedcache-close
As Coverity pointed out, we fail to close the file handle if we have
trouble during the stat call. This is unlikely to result in real leaks
as stat errors should be very rare, but do make sure to close the fd.
-rw-r--r-- | src/sortedcache.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/sortedcache.c b/src/sortedcache.c index ed4199b71..5bd989a9f 100644 --- a/src/sortedcache.c +++ b/src/sortedcache.c @@ -216,6 +216,7 @@ int git_sortedcache_lockandload(git_sortedcache *sc, git_buf *buf) if (p_fstat(fd, &st) < 0) { giterr_set(GITERR_OS, "failed to stat file"); error = -1; + (void)p_close(fd); goto unlock; } |