[Mesa-stable] [PATCH 6/8] anv: don't leak memory if anv_init_wsi() fails

Emil Velikov emil.l.velikov at gmail.com
Thu Nov 24 20:30:43 UTC 2016


From: Emil Velikov <emil.velikov at collabora.com>

brw_compiler_create() rzalloc-ates memory which we forgot to free.

Cc: "13.0" <mesa-stable at lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 src/intel/vulkan/anv_device.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 0e01e28..b4c2e4b 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -203,8 +203,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;
+   }
 
    if (anv_device_get_cache_uuid(device->uuid)) {
       anv_finish_wsi(device);
-- 
2.10.2



More information about the mesa-stable mailing list