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

Timothy Arceri tarceri at itsqueeze.com
Tue Feb 14 00:52:42 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 10b9d81..8eccf72 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -383,7 +383,8 @@ disk_cache_create(const char *gpu_name, const char *timestamp)
 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