intel: Check for region allocation failure.
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 5 Aug 2010 07:34:09 +0000 (08:34 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 5 Aug 2010 07:38:55 +0000 (08:38 +0100)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/mesa/drivers/dri/intel/intel_regions.c

index fe4de18960088765507e0f787f4ce7268366c385..680d18ba2999eac1f6c5c379a36091f6838f1b3a 100644 (file)
@@ -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;