From: Erik Faye-Lund Date: Wed, 27 Nov 2019 16:34:08 +0000 (+0100) Subject: zink: avoid NULL-deref X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e54240f1531ac58f2eefb8df7294a12f187c1cc5;p=mesa.git 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 --- 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); } }