[Mesa-dev] [PATCH mesa 1/2] etnaviv: avoid null dereference in failure path

Christian Gmeiner christian.gmeiner at gmail.com
Thu Feb 9 07:23:18 UTC 2017


Hi Eric

2017-02-09 1:11 GMT+01:00 Eric Engestrom <eric at engestrom.ch>:
> CID: 1400129
> Signed-off-by: Eric Engestrom <eric at engestrom.ch>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_context.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c
> index d767cd1f38..f5fa5c53ae 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_context.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
> @@ -259,7 +259,7 @@ etna_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
>     screen = etna_screen(pscreen);
>     ctx->stream = etna_cmd_stream_new(screen->pipe, 0x2000, &etna_cmd_stream_reset_notify, ctx);
>     if (ctx->stream == NULL)
> -      goto fail;
> +      return NULL;

We will leak the allocated etna_context with that change - we really
want to call pctx->destroy(pctx) to free
all resources. If you are okay with my patch add your Reviewed-by and
I will push it later the day.

>
>     pctx = &ctx->base;
>     pctx->priv = ctx;
> --
> Cheers,
>   Eric
>

greets
--
Christian Gmeiner, MSc

https://www.youtube.com/user/AloryOFFICIAL
https://soundcloud.com/christian-gmeiner


More information about the mesa-dev mailing list