radv: don't leak DRM devices
authorGrazvydas Ignotas <notasas@gmail.com>
Tue, 2 May 2017 17:05:07 +0000 (20:05 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Wed, 3 May 2017 19:04:52 +0000 (22:04 +0300)
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@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_device.c

index 9e66faf7ab89875655aa5c9a2846670124bb7c94..648103d2c79d8d90a74efd809a0e53bc74fad4e1 100644 (file)
@@ -417,9 +417,11 @@ radv_enumerate_devices(struct radv_instance *instance)
                        if (result == VK_SUCCESS)
                                ++instance->physicalDeviceCount;
                        else if (result != VK_ERROR_INCOMPATIBLE_DRIVER)
-                               return result;
+                               break;
                }
        }
+       drmFreeDevices(devices, max_devices);
+
        return result;
 }