[Mesa-dev] [PATCH 37/40] util/disk_cache: check cache exists before calling munmap()

Timothy Arceri tarceri at itsqueeze.com
Tue Feb 7 03:42:41 UTC 2017


---
 src/util/disk_cache.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index da4eb47..a70bd66 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -385,7 +385,8 @@ disk_cache_create(const char *gpu_name, const char *mesa_version)
 void
 disk_cache_destroy(struct disk_cache *cache)
 {
-   munmap(cache->index_mmap, cache->index_mmap_size);
+   if (cache)
+      munmap(cache->index_mmap, cache->index_mmap_size);
 
    ralloc_free(cache);
 }
-- 
2.9.3



More information about the mesa-dev mailing list