diff options
author | Amarnath Valluri <amarnath.valluri@intel.com> | 2016-06-16 17:38:14 +0300 |
---|---|---|
committer | Amarnath Valluri <amarnath.valluri@intel.com> | 2016-06-17 15:07:36 +0300 |
commit | 478d5df91178a35f97cdf90c055d95c358b55e52 (patch) | |
tree | 671983ad333a4775c7039b7264e5f62bc3d564c6 /CCache/stats.c | |
parent | 9b371b48d15cb739af65d91d92cd695e968e11b5 (diff) | |
download | swig-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.c | 5 |
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); |