[PATCH 02/11] etnaviv: fix memory leak when BO allocation fails
Wladimir J. van der Laan
laanwj at gmail.com
Tue Jun 27 14:32:46 UTC 2017
On Fri, Jun 23, 2017 at 05:50:19PM +0200, Lucas Stach wrote:
> The resource struct is already allocated at this point and should be
> free properly.
>
> Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
Reviewed-by: Wladimir J. van der Laan <laanwj at gmail.com>
> ---
> src/gallium/drivers/etnaviv/etnaviv_resource.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index dfd087071193..97e0a15597fa 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -208,7 +208,7 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
> struct etna_bo *bo = etna_bo_new(screen->dev, size, flags);
> if (unlikely(bo == NULL)) {
> BUG("Problem allocating video memory for resource");
> - return NULL;
> + goto free_rsc;
> }
>
> rsc->bo = bo;
> @@ -223,6 +223,10 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
> }
>
> return &rsc->base;
> +
> +free_rsc:
> + FREE(rsc);
> + return NULL;
> }
>
> static struct pipe_resource *
> --
> 2.11.0
>
> _______________________________________________
> etnaviv mailing list
> etnaviv at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
More information about the etnaviv
mailing list