zink: Initialize zink_bindless_descriptor to zero on creation

Make sure to have all fields to 0 as we are then using pipe_resource_reference
on some of its fields.

Fix defect reported by Coverity Scan.

Uninitialized pointer read

Incorrect values could be read from, or even written to, an arbitrary memory location, causing incorrect computations.

CID: 1520759

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27259>
This commit is contained in:
Corentin Noël 2024-01-24 13:30:24 +01:00 committed by Marge Bot
parent 3f0af613d0
commit 66cc73a304

View file

@ -2405,7 +2405,7 @@ zink_create_image_handle(struct pipe_context *pctx, const struct pipe_image_view
debug_printf("couldn't create storage image!");
return 0;
}
bd = malloc(sizeof(struct zink_bindless_descriptor));
bd = calloc(1, sizeof(struct zink_bindless_descriptor));
if (!bd)
return 0;
bd->sampler = NULL;