Adding assertions won't fix the errors found by the static analysis tool
because they don't exist in release builds.  The technical correct way
to deal with memory allocation failures in GL is to generate
GL_OUT_OF_MEMORY and return.

On 11/27/2013 06:53 AM, Juha-Pekka Heikkila wrote:
> Signed-off-by: Juha-Pekka Heikkila <[email protected]>
> ---
>  src/mesa/main/attrib.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
> index c9332bd..5185f89 100644
> --- a/src/mesa/main/attrib.c
> +++ b/src/mesa/main/attrib.c
> @@ -1488,6 +1488,9 @@ init_array_attrib_data(struct gl_context *ctx,
>  {
>     /* Get a non driver gl_array_object. */
>     attrib->ArrayObj = CALLOC_STRUCT( gl_array_object );
> +
> +   assert(attrib->ArrayObj != NULL);
> +
>     _mesa_initialize_array_object(ctx, attrib->ArrayObj, 0);
>  }
>  
> 

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to