diff options
author | Lucas Stach <[email protected]> | 2017-06-09 18:20:56 +0200 |
---|---|---|
committer | Lucas Stach <[email protected]> | 2017-06-29 11:34:50 +0200 |
commit | 4fb9f97047eb1e43c47cb7cacba27ccd20383eff (patch) | |
tree | bc856cc8bc31212d126640934767d46da82f77b8 /src/gallium/drivers/etnaviv | |
parent | b2a87ce34f081671c7e4969874de91ac6953d062 (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]>
Diffstat (limited to 'src/gallium/drivers/etnaviv')
-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 dfd08707119..97e0a15597f 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 * |