pan/bi: Fix memory corruption in scheduler

If empty the last will be bogus, I think. Missing Rust hard right around
now.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
This commit is contained in:
Alyssa Rosenzweig 2020-09-27 19:45:50 -04:00
parent 7c351a6f5d
commit 405544eae5
1 changed files with 3 additions and 2 deletions

View File

@ -241,10 +241,11 @@ bi_schedule(bi_context *ctx)
/* Back-to-back bit affects only the last clause of a block,
* the rest are implicitly true */
bi_clause *last_clause = list_last_entry(&bblock->clauses, bi_clause, link);
if (last_clause)
if (!list_is_empty(&bblock->clauses)) {
bi_clause *last_clause = list_last_entry(&bblock->clauses, bi_clause, link);
last_clause->back_to_back = bi_back_to_back(bblock);
}
bblock->scheduled = true;
}