zink: avoid NULL-deref
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 27 Nov 2019 16:17:08 +0000 (17:17 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 29 Nov 2019 08:54:25 +0000 (09:54 +0100)
zink_render_pass_reference will dereference the memory 'dst' points at,
which can't really go well. All we want to do here is to increase the
reference-count, so let's use a different helper for that instead.

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

index 92a75489cf557569dead907016d5f2d2c4741c18..95b47a69d934e99b4b8bfb0d780c4871769bf202 100644 (file)
@@ -210,9 +210,8 @@ reference_render_pass(struct zink_screen *screen,
    struct set_entry *entry = _mesa_set_search(prog->render_passes,
                                               render_pass);
    if (!entry) {
-      struct zink_render_pass *tmp = NULL;
       entry = _mesa_set_add(prog->render_passes, render_pass);
-      zink_render_pass_reference(screen, &tmp, render_pass);
+      pipe_reference(NULL, &render_pass->reference);
    }
 }