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:
committed by
Marge Bot
parent
5e09b2b3f3
commit
eab3ee8d71
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user