zink: avoid NULL-deref
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 27 Nov 2019 16:34:08 +0000 (17:34 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 29 Nov 2019 08:54:25 +0000 (09:54 +0100)
Similar to the previous commit, pipe_resource_reference also dereference
the memory pointed at. Let's avoid it.

CoverityID: 1455198
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/zink/zink_batch.c

index 74700acb3405921201e24c1f65938aa46cce9153..c31e175d6d62d0241500f39c12c3f6d5a87115e6 100644 (file)
@@ -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);
    }
 }