anv: don't leak memory if anv_init_wsi() fails
authorEmil Velikov <emil.velikov@collabora.com>
Thu, 24 Nov 2016 20:30:43 +0000 (20:30 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Mon, 28 Nov 2016 19:47:34 +0000 (19:47 +0000)
brw_compiler_create() rzalloc-ates memory which we forgot to free.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/anv_device.c

index a410376a9c775c62171e3580bf8292e586a94b98..0518aafadbef7cc221d6aacb8ca320acd8369832 100644 (file)
@@ -208,8 +208,10 @@ anv_physical_device_init(struct anv_physical_device *device,
    device->compiler->shader_perf_log = compiler_perf_log;
 
    result = anv_init_wsi(device);
-   if (result != VK_SUCCESS)
-       goto fail;
+   if (result != VK_SUCCESS) {
+      ralloc_free(device->compiler);
+      goto fail;
+   }
 
    isl_device_init(&device->isl_dev, &device->info, swizzled);