CCache: Fix memory/file descriptor leaks

Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
This commit is contained in:
Amarnath Valluri 2016-06-16 17:38:14 +03:00
commit 478d5df911
5 changed files with 25 additions and 4 deletions

View file

@ -138,7 +138,10 @@ static void stats_update_size(enum stats stat, size_t size, size_t numfiles)
memset(counters, 0, sizeof(counters));
if (lock_fd(fd) != 0) return;
if (lock_fd(fd) != 0) {
close(fd);
return;
}
/* read in the old stats */
stats_read_fd(fd, counters);