[Mesa-dev] [PATCH 3/3] mesa: rework how we free gl_shader_program_data

Neil Roberts nroberts at igalia.com
Wed Nov 8 08:17:14 UTC 2017


This seems like a nice solution to me. I just have a small comment
below.

> -static struct gl_shader_program_data *
> -create_shader_program_data()
> +struct gl_shader_program_data *
> +_mesa_create_shader_program_data()
>  {
>     struct gl_shader_program_data *data;
>     data = rzalloc(NULL, struct gl_shader_program_data);
>     if (data)
>        data->RefCount = 1;
>  
> +   data->InfoLog = ralloc_strdup(data, "");
> +

The addition of this line makes the “if (data)” above look odd because
if the rzalloc fails it’s now going to just crash immediately anyway.
I’m not sure what the policy is supposed to be but a quick grep finds
other places in the compiler that seem to assume that ralloc can not
fail, so it might be nice to just remove the if.

Reviewed-by: Neil Roberts <nroberts at igalia.com>

Regards,
- Neil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171108/f5f59702/attachment.sig>


More information about the mesa-dev mailing list