zink: avoid NULL-deref
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 27 Nov 2019 16:38:53 +0000 (17:38 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 29 Nov 2019 08:54:25 +0000 (09:54 +0100)
Same story as the previous two commits; these functions dereference the
memory they are pointed at. We can't do that.

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

index c31e175d6d62d0241500f39c12c3f6d5a87115e6..a73128d499368f2478c1a7302cf7691ef4c2da2b 100644 (file)
@@ -113,8 +113,7 @@ zink_batch_reference_sampler_view(struct zink_batch *batch,
 {
    struct set_entry *entry = _mesa_set_search(batch->sampler_views, sv);
    if (!entry) {
-      struct pipe_sampler_view *tmp = NULL;
       entry = _mesa_set_add(batch->sampler_views, sv);
-      pipe_sampler_view_reference(&tmp, &sv->base);
+      pipe_reference(NULL, &sv->base.reference);
    }
 }