[Mesa-dev] [PATCH 4/7] vl/buffer: add sanity check after CALLOC_STRUCT

Christian König deathsimple at vodafone.de
Sun Aug 18 04:33:45 PDT 2013


Am 17.08.2013 23:51, schrieb Emil Velikov:
> Check if we have successfully allocated memory.
>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>

Reviewed-by: Christian König <christian.koenig at amd.com>

> ---
>   src/gallium/auxiliary/vl/vl_video_buffer.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c
> index 9600ce9..22e618a 100644
> --- a/src/gallium/auxiliary/vl/vl_video_buffer.c
> +++ b/src/gallium/auxiliary/vl/vl_video_buffer.c
> @@ -490,6 +490,8 @@ vl_video_buffer_create_ex2(struct pipe_context *pipe,
>      unsigned i;
>   
>      buffer = CALLOC_STRUCT(vl_video_buffer);
> +   if (!buffer)
> +      return NULL;
>   
>      buffer->base = *tmpl;
>      buffer->base.context = pipe;



More information about the mesa-dev mailing list