summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/i965/brw_program_cache.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_program_cache.c b/src/mesa/drivers/dri/i965/brw_program_cache.c
index c06ee23781c..b0e2962f88f 100644
--- a/src/mesa/drivers/dri/i965/brw_program_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_program_cache.c
@@ -485,10 +485,13 @@ brw_destroy_cache(struct brw_context *brw, struct brw_cache *cache)
DBG("%s\n", __func__);
- if (brw->has_llc)
- brw_bo_unmap(cache->bo);
- brw_bo_unreference(cache->bo);
- cache->bo = NULL;
+ /* This can be NULL if context creation failed early on */
+ if (cache->bo) {
+ if (brw->has_llc)
+ brw_bo_unmap(cache->bo);
+ brw_bo_unreference(cache->bo);
+ cache->bo = NULL;
+ }
brw_clear_cache(brw, cache);
free(cache->items);
cache->items = NULL;