[Mesa-dev] [PATCH] intel: Add a null pointer check before dereferencing the pointer

Jordan Justen jljusten at gmail.com
Tue Apr 16 14:54:16 PDT 2013


Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>

On Tue, Apr 16, 2013 at 11:11 AM, Anuj Phogat <anuj.phogat at gmail.com> wrote:
>
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
>  src/mesa/drivers/dri/intel/intel_screen.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
> index 16750f2..27b992c 100644
> --- a/src/mesa/drivers/dri/intel/intel_screen.c
> +++ b/src/mesa/drivers/dri/intel/intel_screen.c
> @@ -707,6 +707,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);
> --
> 1.8.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list