diff options
author | Anuj Phogat <[email protected]> | 2013-04-16 10:34:43 -0700 |
---|---|---|
committer | Chad Versace <[email protected]> | 2013-06-26 14:21:47 -0700 |
commit | 8b6aa864eafb99e572fff34a0cac41f8d54b9640 (patch) | |
tree | c15083ef73f0b0728bc6983726c9b4ee5ba0b3d2 /src/mesa | |
parent | bd5ccbd4ebb08ab488491eb154dea112e2bdea99 (diff) |
intel: Add a null pointer check before dereferencing the pointer
Reviewed-by: Jordan Justen <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
(cherry picked from commit 484b89ace99cb34719ff79c6aab1658bb8f3dc79)
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_screen.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 72f8762bae2..539b3d14aa0 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -306,6 +306,9 @@ intel_create_image_from_name(__DRIscreen *screen, int cpp; image = intel_allocate_image(format, loaderPrivate); + if (image == NULL) + return NULL; + if (image->format == MESA_FORMAT_NONE) cpp = 1; else @@ -399,6 +402,9 @@ intel_create_image(__DRIscreen *screen, } image = intel_allocate_image(format, loaderPrivate); + if (image == NULL) + return NULL; + cpp = _mesa_get_format_bytes(image->format); image->region = intel_region_alloc(intelScreen, tiling, cpp, width, height, true); @@ -545,6 +551,9 @@ intel_from_planar(__DRIimage *parent, int plane, void *loaderPrivate) stride = parent->strides[index]; image = intel_allocate_image(dri_format, loaderPrivate); + if (image == NULL) + return NULL; + if (offset + height * stride > parent->region->bo->size) { _mesa_warning(NULL, "intel_create_sub_image: subimage out of bounds"); free(image); |