Mesa (master): intel: Check for region allocation failure.

Chris Wilson ickle at kemper.freedesktop.org
Thu Aug 5 07:39:56 UTC 2010


Module: Mesa
Branch: master
Commit: 85cfe321805264686ef8989e45a911a999ed928a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=85cfe321805264686ef8989e45a911a999ed928a

Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Aug  5 08:34:09 2010 +0100

intel: Check for region allocation failure.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

---

 src/mesa/drivers/dri/intel/intel_regions.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c
index fe4de18..680d18b 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -155,6 +155,9 @@ intel_region_alloc_internal(struct intel_context *intel,
    }
 
    region = calloc(sizeof(*region), 1);
+   if (region == NULL)
+      return region;
+
    region->cpp = cpp;
    region->width = width;
    region->height = height;
@@ -189,6 +192,9 @@ intel_region_alloc(struct intel_context *intel,
 
    region = intel_region_alloc_internal(intel, cpp, width, height,
 					aligned_pitch / cpp, buffer);
+   if (region == NULL)
+      return region;
+
    region->tiling = tiling;
 
    return region;




More information about the mesa-commit mailing list