From e54240f1531ac58f2eefb8df7294a12f187c1cc5 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 27 Nov 2019 17:34:08 +0100 Subject: [PATCH] zink: avoid NULL-deref Similar to the previous commit, pipe_resource_reference also dereference the memory pointed at. Let's avoid it. CoverityID: 1455198 Reviewed-by: Dave Airlie --- src/gallium/drivers/zink/zink_batch.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c index 74700acb340..c31e175d6d6 100644 --- a/src/gallium/drivers/zink/zink_batch.c +++ b/src/gallium/drivers/zink/zink_batch.c @@ -102,9 +102,8 @@ zink_batch_reference_resoure(struct zink_batch *batch, { struct set_entry *entry = _mesa_set_search(batch->resources, res); if (!entry) { - struct pipe_resource *tmp = NULL; entry = _mesa_set_add(batch->resources, res); - pipe_resource_reference(&tmp, &res->base); + pipe_reference(NULL, &res->base.reference); } } -- 2.30.2