Use calloc to allocate memory for the search path
authorCharles Giessen <charles@lunarg.com>
Thu, 26 May 2022 23:25:19 +0000 (17:25 -0600)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Fri, 27 May 2022 17:12:46 +0000 (11:12 -0600)
This prevents bugs where uninitialized memory is treated as a real path. It
should fix an issue where sometimes CI would fail due to what appears to be a
spurious path with junk characters.

loader/loader.c

index 820e2e33ffd042d46334a36781969a9a13a9b43c..9e9ec73a22c11db93d357440e3b3f8ae45d5b63d 100644 (file)
@@ -3051,7 +3051,7 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in
     }
 
     // Allocate the required space
-    search_path = loader_instance_heap_alloc(inst, search_path_size, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
+    search_path = loader_instance_heap_calloc(inst, search_path_size, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
     if (NULL == search_path) {
         loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0,
                    "read_data_files_in_search_paths: Failed to allocate space for search path of length %d",