etnaviv: Destroy rsc->pending_ctx set in etna_resource_destroy()
authorMarek Vasut <marex@denx.de>
Thu, 30 Jan 2020 00:40:31 +0000 (01:40 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 4 Feb 2020 06:27:19 +0000 (06:27 +0000)
Destroy rsc->pending_ctx set in etna_resource_destroy(), otherwise
the memory is allocated, never free'd, and becomes unreachable. This
fixes a memory leak.

Fixes: 9e672e4d20fb ("etnaviv: keep references to pending resources")
Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3633>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3633>

src/gallium/drivers/etnaviv/etnaviv_resource.c

index 03b3ef8719e5036d30a21897fc459574973fb11d..4a992b5f668d14f37199e0b729e6a6dbc3c2cf4f 100644 (file)
@@ -464,6 +464,7 @@ etna_resource_destroy(struct pipe_screen *pscreen, struct pipe_resource *prsc)
    struct etna_resource *rsc = etna_resource(prsc);
 
    assert(!_mesa_set_next_entry(rsc->pending_ctx, NULL));
+   _mesa_set_destroy(rsc->pending_ctx, NULL);
 
    if (rsc->bo)
       etna_bo_del(rsc->bo);