[Mesa-dev] [PATCH 2/4] mesa: check allocation failures in new_transform_feedback()

Timothy Arceri tarceri at itsqueeze.com
Fri Aug 25 00:04:26 UTC 2017



On 24/08/17 21:43, Samuel Pitoiset wrote:
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>   src/mesa/main/transformfeedback.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
> index 9ffbfe7e6c..e30448ea4f 100644
> --- a/src/mesa/main/transformfeedback.c
> +++ b/src/mesa/main/transformfeedback.c
> @@ -207,7 +207,11 @@ static struct gl_transform_feedback_object *
>   new_transform_feedback(struct gl_context *ctx, GLuint name)
>   {
>      struct gl_transform_feedback_object *obj;
> +
>      obj = CALLOC_STRUCT(gl_transform_feedback_object);
> +   if (!obj)
> +      return NULL;
> +

We should probably be doing a NULL check in 
_mesa_init_transform_feedback() also, and have that return a bool to 
init_attrib_groups(), but this doesn't make things any worse so for the 
series:

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

>      _mesa_init_transform_feedback_object(obj, name);
>      return obj;
>   }
> 


More information about the mesa-dev mailing list