summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGwan-gyeong Mun <elongbug@gmail.com>2016-11-22 00:21:23 +0900
committerEmil Velikov <emil.l.velikov@gmail.com>2016-11-24 16:34:41 +0000
commitc19a3311398bdb6a2fd408f017f16a73ad8a801c (patch)
tree971aa80d52bbbf0ddd9efa084419162cd9ba686e
parentd6964bbf54a526d4a28ff88c61349eb24a64af6f (diff)
downloadexternal_mesa3d-c19a3311398bdb6a2fd408f017f16a73ad8a801c.zip
external_mesa3d-c19a3311398bdb6a2fd408f017f16a73ad8a801c.tar.gz
external_mesa3d-c19a3311398bdb6a2fd408f017f16a73ad8a801c.tar.bz2
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" <mesa-stable@lists.freedesktop.org> Signed-off-by: Mun Gwan-gyeong <elongbug@gmail.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> (v1) (cherry picked from commit 69cc7d90f9f60d95cd570a4e87755a474554d41f)
-rw-r--r--src/compiler/glsl/cache.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/compiler/glsl/cache.c b/src/compiler/glsl/cache.c
index 64a34f0..db934e5 100644
--- a/src/compiler/glsl/cache.c
+++ b/src/compiler/glsl/cache.c
@@ -612,19 +612,18 @@ cache_put(struct program_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 *