util/idalloc: make deleting invalid IDs a no-op

This happens with piglit tests if we enable ForceGLNamesReuse
for everything.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27586>
This commit is contained in:
Marek Olšák 2024-02-06 00:06:57 -05:00 committed by Marge Bot
parent 5438b19104
commit 716e483cfb

View file

@ -144,8 +144,11 @@ ret:
void
util_idalloc_free(struct util_idalloc *buf, unsigned id)
{
assert(id / 32 < buf->num_elements);
unsigned idx = id / 32;
if (idx >= buf->num_elements)
return;
buf->lowest_free_idx = MIN2(idx, buf->lowest_free_idx);
buf->data[idx] &= ~(1 << (id % 32));
}