summaryrefslogtreecommitdiff
path: root/loader/loader_windows.c
diff options
context:
space:
mode:
authorCharles Giessen <charles@lunarg.com>2022-05-20 19:56:19 -0600
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>2022-05-24 14:18:26 -0600
commit2d1565377360833be414d49fc39c4d23f71a9f89 (patch)
treeb7d813928687b4f274ba655d0781ca994c5cce1f /loader/loader_windows.c
parent9b355f194844ad4414816f283664f8b28819451a (diff)
downloadVulkan-Loader-2d1565377360833be414d49fc39c4d23f71a9f89.tar.gz
Vulkan-Loader-2d1565377360833be414d49fc39c4d23f71a9f89.tar.bz2
Vulkan-Loader-2d1565377360833be414d49fc39c4d23f71a9f89.zip
Use calloc instead of alloc+memset
Replace naked uses of malloc & free with loader_alloc & loader_free.
Diffstat (limited to 'loader/loader_windows.c')
-rw-r--r--loader/loader_windows.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/loader/loader_windows.c b/loader/loader_windows.c
index 27dcd73c..cc469a4e 100644
--- a/loader/loader_windows.c
+++ b/loader/loader_windows.c
@@ -804,15 +804,13 @@ VkResult windows_read_sorted_physical_devices(struct loader_instance *inst, uint
goto out;
}
sorted_alloc = 16;
- *sorted_devices =
- loader_instance_heap_alloc(inst, sorted_alloc * sizeof(struct loader_phys_dev_per_icd), VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
+ *sorted_devices = loader_instance_heap_calloc(inst, sorted_alloc * sizeof(struct loader_phys_dev_per_icd),
+ VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
if (*sorted_devices == NULL) {
res = VK_ERROR_OUT_OF_HOST_MEMORY;
goto out;
}
- memset(*sorted_devices, 0, sorted_alloc * sizeof(struct loader_phys_dev_per_icd));
-
for (uint32_t i = 0;; ++i) {
IDXGIAdapter1 *adapter;
hres = dxgi_factory->lpVtbl->EnumAdapterByGpuPreference(dxgi_factory, i, DXGI_GPU_PREFERENCE_UNSPECIFIED,
@@ -998,4 +996,4 @@ VkResult windows_sort_physical_device_groups(struct loader_instance *inst, const
return VK_SUCCESS;
}
-#endif // _WIN32 \ No newline at end of file
+#endif // _WIN32