radv: fix memory leak from physical device if wsi fails
authorDave Airlie <airlied@redhat.com>
Tue, 11 Oct 2016 22:52:56 +0000 (08:52 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 11 Oct 2016 22:53:44 +0000 (08:53 +1000)
Inspired by patch from Edward O'Callaghan <funfunctor@folklore1984.net>
which didn't do it right.

Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_device.c

index 8c59344a3c8593d902495cc961bfd7205a904289..79ef8ed55db357994deb60a6a5a2719003c94da6 100644 (file)
@@ -74,8 +74,10 @@ radv_physical_device_init(struct radv_physical_device *device,
        }
        device->ws->query_info(device->ws, &device->rad_info);
        result = radv_init_wsi(device);
-       if (result != VK_SUCCESS)
+       if (result != VK_SUCCESS) {
+               device->ws->destroy(device->ws);
                goto fail;
+       }
 
        fprintf(stderr, "WARNING: radv is not a conformant vulkan implementation, testing use only.\n");
        device->name = device->rad_info.name;