[Mesa-dev] [PATCH] i965: Add missing null checks in intel_mipmap_tree.c

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Wed Feb 17 15:07:00 UTC 2016


Just check miptree_create() returned other than NULL as everywhere
else in the file.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 6c233d8..5b0e938 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -726,6 +726,9 @@ intel_miptree_create(struct brw_context *brw,
                                      width0, height0, depth0, num_samples,
                                      layout_flags);
 
+   if (!mt)
+      return NULL;
+
    /* If the BO is too large to fit in the aperture, we need to use the
     * BLT engine to support it.  Prior to Sandybridge, the BLT paths can't
     * handle Y-tiling, so we need to fall back to X.
@@ -1527,6 +1530,9 @@ intel_miptree_alloc_mcs(struct brw_context *brw,
                                0 /* num_samples */,
                                mcs_flags);
 
+   if (!mt->mcs_mt)
+      return false;
+
    intel_miptree_init_mcs(brw, mt, 0xFF);
 
    return mt->mcs_mt;
-- 
1.9.1



More information about the mesa-dev mailing list