broadcom/compiler: use safe iterator to remove instructions

The current approach has an issue detected by static analyzer: use of
memory after it is freed.

Using a proper iterator makes things safer.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34050>
This commit is contained in:
Juan A. Suarez Romero 2025-03-13 10:56:39 +01:00 committed by Marge Bot
parent 0b0d6a36f2
commit 01151f045f

View file

@ -2197,10 +2197,7 @@ vir_compile_destroy(struct v3d_compile *c)
c->cursor.link = NULL;
vir_for_each_block(block, c) {
while (!list_is_empty(&block->instructions)) {
struct qinst *qinst =
list_first_entry(&block->instructions,
struct qinst, link);
list_for_each_entry_safe(struct qinst, qinst, &block->instructions, link) {
vir_remove_instruction(c, qinst);
}
}