[Mesa-dev] [PATCH] radv: don't leak DRM devices

Grazvydas Ignotas notasas at gmail.com
Tue May 2 17:17:04 UTC 2017


After successful drmGetDevices2() call, drmFreeDevices() needs to be
called.

Fixes: 743315f2 "radv: do not open random render node(s)"
Signed-off-by: Grazvydas Ignotas <notasas at gmail.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 214b2e0..4b27fd0 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -415,13 +415,15 @@ radv_enumerate_devices(struct radv_instance *instance)
 			                                   instance,
 			                                   devices[i]->nodes[DRM_NODE_RENDER]);
 			if (result == VK_SUCCESS)
 				++instance->physicalDeviceCount;
 			else if (result != VK_ERROR_INCOMPATIBLE_DRIVER)
-				return result;
+				break;
 		}
 	}
+	drmFreeDevices(devices, max_devices);
+
 	return result;
 }
 
 VkResult radv_EnumeratePhysicalDevices(
 	VkInstance                                  _instance,
-- 
2.7.4



More information about the mesa-dev mailing list