[Mesa-dev] [PATCH] st/mesa: init winsys buffers list only if context creation succeeds

Brian Paul brianp at vmware.com
Mon Jul 17 18:23:23 UTC 2017


On 07/11/2017 11:14 PM, Charmaine Lee wrote:
> Fixes piglit test crash when context creation fails.
> ---
>   src/mesa/state_tracker/st_context.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
> index 560d94e..8eccad6 100644
> --- a/src/mesa/state_tracker/st_context.c
> +++ b/src/mesa/state_tracker/st_context.c
> @@ -574,11 +574,11 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
>      st = st_create_context_priv(ctx, pipe, options, no_error);
>      if (!st) {
>         _mesa_destroy_context(ctx);
> +   } else {
> +      /* Initialize context's winsys buffers list */
> +      LIST_INITHEAD(&st->winsys_buffers);
>      }
>
> -   /* Initialize context's winsys buffers list */
> -   LIST_INITHEAD(&st->winsys_buffers);
> -
>      return st;
>   }
>
>


It might be better to call LIST_INITHEAD() in st_create_context_priv() 
where we init the other fields of st_context.

-Brian



More information about the mesa-dev mailing list