Mesa (master): radv: fix memory leak from physical device if wsi fails

Dave Airlie airlied at kemper.freedesktop.org
Tue Oct 11 22:53:53 UTC 2016


Module: Mesa
Branch: master
Commit: 6215b476482fa3a76d3245d88ab127a7c060e115
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6215b476482fa3a76d3245d88ab127a7c060e115

Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Oct 12 08:52:56 2016 +1000

radv: fix memory leak from physical device if wsi fails

Inspired by patch from Edward O'Callaghan <funfunctor at folklore1984.net>
which didn't do it right.

Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/amd/vulkan/radv_device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 8c59344..79ef8ed 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -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;




More information about the mesa-commit mailing list