mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 00:30:11 +01:00
vc4: do not access member of a NULL structure
Check if the structure is NULL before trying to get access to its members. This has been detected by the Undefined Behaviour Sanitizer (UBSan). Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29911>
This commit is contained in:
parent
5e09b2b3f3
commit
eab3ee8d71
1 changed files with 2 additions and 1 deletions
|
|
@ -65,7 +65,8 @@ vc4_fence_reference(struct pipe_screen *pscreen,
|
|||
struct vc4_fence *f = vc4_fence(pf);
|
||||
struct vc4_fence *old = *p;
|
||||
|
||||
if (pipe_reference(&(*p)->reference, &f->reference)) {
|
||||
if (pipe_reference(old ? &old->reference : NULL,
|
||||
f ? &f->reference : NULL)) {
|
||||
if (old->fd >= 0)
|
||||
close(old->fd);
|
||||
free(old);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue