radv: Fix memory allocation failure path in compute resolve init.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sun, 21 Jan 2018 19:20:50 +0000 (20:20 +0100)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sun, 21 Jan 2018 23:07:19 +0000 (00:07 +0100)
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_meta_resolve_cs.c

index 5b3bc89832b5c3e3afe41b6e0d7bc65ed38464ad..519e2a5f4283c5faf398d9f357550abf85a7508a 100644 (file)
@@ -253,22 +253,31 @@ radv_device_init_meta_resolve_compute_state(struct radv_device *device)
 
        res = create_layout(device);
        if (res != VK_SUCCESS)
-               return res;
+               goto fail;
 
        for (uint32_t i = 0; i < MAX_SAMPLES_LOG2; ++i) {
                uint32_t samples = 1 << i;
 
                res = create_resolve_pipeline(device, samples, false, false,
                                              &state->resolve_compute.rc[i].pipeline);
+               if (res != VK_SUCCESS)
+                       goto fail;
 
                res = create_resolve_pipeline(device, samples, true, false,
                                              &state->resolve_compute.rc[i].i_pipeline);
+               if (res != VK_SUCCESS)
+                       goto fail;
 
                res = create_resolve_pipeline(device, samples, false, true,
                                              &state->resolve_compute.rc[i].srgb_pipeline);
+               if (res != VK_SUCCESS)
+                       goto fail;
 
        }
 
+       return VK_SUCCESS;
+fail:
+       radv_device_finish_meta_resolve_compute_state(device);
        return res;
 }