mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 12:08:06 +02:00
etnaviv: fix memory leak when BO allocation fails
The resource struct is already allocated at this point and should be freed properly. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com> Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com>
This commit is contained in:
parent
b2a87ce34f
commit
4fb9f97047
1 changed files with 5 additions and 1 deletions
|
|
@ -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 *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue