i965: Check result of make_surface() for intel_miptree_create_for_bo
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 31 Jul 2017 09:22:44 +0000 (10:22 +0100)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 2 Aug 2017 04:28:09 +0000 (21:28 -0700)
Since make_surface() can fail, if the format isn't support by hw or
simlar error, we need to check the result before dereferencing it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/intel_mipmap_tree.c

index 628d80c0ff8ecad562b6332a18acc04371ee44dd..daa49f99228c4858edcb2f33b657eda69762be27 100644 (file)
@@ -792,6 +792,8 @@ intel_miptree_create_for_bo(struct brw_context *brw,
                         0, 0, width, height, depth, 1, ISL_TILING_Y0_BIT,
                         ISL_SURF_USAGE_DEPTH_BIT | ISL_SURF_USAGE_TEXTURE_BIT,
                         BO_ALLOC_FOR_RENDER, pitch, bo);
                         0, 0, width, height, depth, 1, ISL_TILING_Y0_BIT,
                         ISL_SURF_USAGE_DEPTH_BIT | ISL_SURF_USAGE_TEXTURE_BIT,
                         BO_ALLOC_FOR_RENDER, pitch, bo);
+      if (!mt)
+         return NULL;
 
       brw_bo_reference(bo);
 
 
       brw_bo_reference(bo);