mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
util: 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: Alyssa Rosenzweig <alyssa@rosenzweig.io> Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29772>
This commit is contained in:
parent
d854dd32fb
commit
d4dcbaf825
1 changed files with 2 additions and 1 deletions
|
|
@ -128,7 +128,8 @@ pipe_surface_release(struct pipe_context *pipe, struct pipe_surface **ptr)
|
|||
{
|
||||
struct pipe_surface *old = *ptr;
|
||||
|
||||
if (pipe_reference_described(&old->reference, NULL,
|
||||
if (pipe_reference_described(old ? &old->reference : NULL,
|
||||
NULL,
|
||||
(debug_reference_descriptor)
|
||||
debug_describe_surface))
|
||||
pipe->surface_destroy(pipe, old);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue