diff options
author | Gwan-gyeong Mun <[email protected]> | 2016-11-22 00:21:23 +0900 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2016-11-22 15:13:42 +0000 |
commit | 69cc7d90f9f60d95cd570a4e87755a474554d41f (patch) | |
tree | 97132088b403940cfeebd91a35b5ad2a12ffc0f5 /src | |
parent | 0e8dc81c3acf5999b6e9263ee320a4db31742119 (diff) |
util/disk_cache: close a previously opened handle in disk_cache_put (v2)
We're missing the close() to the matching open().
CID 1373407
v2: Fixes from Emil Velikov's review
Update the teardown in reverse order of the setup/init.
Cc: "13.0" <[email protected]>
Signed-off-by: Mun Gwan-gyeong <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Reviewed-by: Iago Toral Quiroga <[email protected]> (v1)
Diffstat (limited to 'src')
-rw-r--r-- | src/util/disk_cache.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index 428787820e3..80dc7881d59 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -612,19 +612,18 @@ disk_cache_put(struct disk_cache *cache, p_atomic_add(cache->size, size); + done: + if (fd_final != -1) + close(fd_final); /* This close finally releases the flock, (now that the final dile * has been renamed into place and the size has been added). */ - close(fd); - fd = -1; - - done: + if (fd != -1) + close(fd); if (filename_tmp) ralloc_free(filename_tmp); if (filename) ralloc_free(filename); - if (fd != -1) - close(fd); } void * |