summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorAnuj Phogat <[email protected]>2013-04-16 10:34:43 -0700
committerAnuj Phogat <[email protected]>2013-04-17 08:17:47 -0700
commit484b89ace99cb34719ff79c6aab1658bb8f3dc79 (patch)
treec24d84c349a74a21eba82cf4fe8fe37acbd78075 /src/mesa/drivers/dri
parentb03f6de63b05a3064d6d33e3c0a429ca97ba2be8 (diff)
intel: Add a null pointer check before dereferencing the pointer
Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c9
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 16750f2717e..00e7bc6cb77 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -368,6 +368,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
@@ -504,6 +507,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);
@@ -707,6 +713,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);