[Mesa-dev] [PATCH] intel: add null src pointer check in intel_region_reference()

Brian Paul brianp at vmware.com
Thu Jul 7 16:31:47 PDT 2011


Fixes segfault when running cubemap demo on i945.  This happened
when intel_region_reference() was called in i915_set_draw_region()
with depth_region=NULL.
---
 src/mesa/drivers/dri/intel/intel_regions.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c
index 6cf37c4..4c4945c 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -271,7 +271,8 @@ intel_region_reference(struct intel_region **dst, struct intel_region *src)
       if (*dst)
 	 intel_region_release(dst);
 
-      src->refcount++;
+      if (src)
+         src->refcount++;
       *dst = src;
    }
 }
-- 
1.7.3.4



More information about the mesa-dev mailing list