v3dv: don't leak variant QPU when pipeline compile fails

Typically we free them when we upload the QPU code from the variant
to the assembly BO in the pipeline, however, if there is an error
during pipeline compilation that may not happen and we would leak
the QPU code from the variants.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16370>
This commit is contained in:
Iago Toral Quiroga 2022-05-09 09:14:28 +02:00 committed by Marge Bot
parent fd02ddc81b
commit 79f4e33f04

View file

@ -94,6 +94,8 @@ v3dv_shader_variant_destroy(struct v3dv_device *device,
/* The assembly BO is shared by all variants in the pipeline, so it can't
* be freed here and should be freed with the pipeline
*/
if (variant->qpu_insts)
free(variant->qpu_insts);
ralloc_free(variant->prog_data.base);
vk_free(&device->vk.alloc, variant);
}