diff options
author | Lucas Stach <[email protected]> | 2017-06-09 18:20:56 +0200 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-08-03 00:19:07 +0100 |
commit | 18a1b73ce2ef2dc24a9110c76488f5e09420363b (patch) | |
tree | d3e3590325fb8ef0bc8afe437e8b7c12209bf446 | |
parent | 1b0beffb6244d14f642e323f446d4ea194d05c59 (diff) |
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 <[email protected]>
Reviewed-by: Philipp Zabel <[email protected]>
Reviewed-by: Christian Gmeiner <[email protected]>
Reviewed-by: Wladimir J. van der Laan <[email protected]>
(cherry picked from commit 4fb9f97047eb1e43c47cb7cacba27ccd20383eff)
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_resource.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c index 2bb849a3dca..eb27a304ae6 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 * |