etnaviv: fix read staging buffer leak

Currently we only free a potentially allocated staging buffer
when the mapping is a write mapping, but staging buffers can
also be allocated for read mappings. Fix the read staging
buffer leaks by always freeing the staging buffer.

Closes #9967

Cc: mesa-stable
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25646>
This commit is contained in:
Lucas Stach 2023-10-10 19:29:37 +02:00 committed by Marge Bot
parent c619d9c1b6
commit aeb6584ecd

View file

@ -153,8 +153,6 @@ etna_transfer_unmap(struct pipe_context *pctx, struct pipe_transfer *ptrans)
} else {
BUG("unsupported tiling %i", rsc->layout);
}
FREE(trans->staging);
}
if (ptrans->resource->target == PIPE_BUFFER)
@ -179,6 +177,7 @@ etna_transfer_unmap(struct pipe_context *pctx, struct pipe_transfer *ptrans)
if (!trans->rsc && !(ptrans->usage & PIPE_MAP_UNSYNCHRONIZED))
etna_bo_cpu_fini(rsc->bo);
FREE(trans->staging);
pipe_resource_reference(&trans->rsc, NULL);
pipe_resource_reference(&ptrans->resource, NULL);
slab_free(&ctx->transfer_pool, trans);