aboutsummaryrefslogtreecommitdiff
path: root/CCache/stats.c
diff options
context:
space:
mode:
authorAmarnath Valluri <amarnath.valluri@intel.com>2016-06-16 17:38:14 +0300
committerAmarnath Valluri <amarnath.valluri@intel.com>2016-06-17 15:07:36 +0300
commit478d5df91178a35f97cdf90c055d95c358b55e52 (patch)
tree671983ad333a4775c7039b7264e5f62bc3d564c6 /CCache/stats.c
parent9b371b48d15cb739af65d91d92cd695e968e11b5 (diff)
downloadswig-478d5df91178a35f97cdf90c055d95c358b55e52.tar.gz
CCache: Fix memory/file descriptor leaks
Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
Diffstat (limited to 'CCache/stats.c')
-rw-r--r--CCache/stats.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/CCache/stats.c b/CCache/stats.c
index d2122bcd3..db0d4d2bf 100644
--- a/CCache/stats.c
+++ b/CCache/stats.c
@@ -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);