summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-02-07 12:10:19 +1100
committerTimothy Arceri <[email protected]>2017-02-17 11:18:43 +1100
commita3ab09f90f83e09578985fbac39e39121d084b75 (patch)
treec6f9a255e2375bba7b5cf78a5c9eb959cd809b0e
parent512c046eddc16bec9c309a3c7b4205d94ffc4ef3 (diff)
util/disk_cache: check cache exists before calling munmap()
Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r--src/util/disk_cache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index 250c3316244..1f4e8960e9e 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -377,7 +377,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);
}