util/disk_cache: check cache exists before calling munmap()
authorTimothy Arceri <tarceri@itsqueeze.com>
Tue, 7 Feb 2017 01:10:19 +0000 (12:10 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Fri, 17 Feb 2017 00:18:43 +0000 (11:18 +1100)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/util/disk_cache.c

index 250c3316244fd2ac5dcd883de84a4d13941e6737..1f4e8960e9e3341667b196366b17937a5e2f2381 100644 (file)
@@ -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);
 }