From 83404e8e571719a50c831b06aed3616d6349ab77 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Wed, 13 Oct 2021 20:05:36 +0100 Subject: [PATCH] vkd3d: Use calloc for virtual query map Signed-off-by: Joshua Ashton --- libs/vkd3d/command.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 6e565888..611dff10 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -3249,7 +3249,7 @@ static bool d3d12_command_list_gather_pending_queries(struct d3d12_command_list entry_buffer_size, ssbo_alignment, &entry_buffer)) goto cleanup; - if (!(query_map = vkd3d_malloc(sizeof(*query_map) * query_map_size)) || + if (!(query_map = vkd3d_calloc(query_map_size, sizeof(*query_map))) || !(query_list = vkd3d_malloc(sizeof(*query_list) * list->pending_queries_count))) { ERR("Failed to allocate query map.\n"); @@ -3263,7 +3263,8 @@ static bool d3d12_command_list_gather_pending_queries(struct d3d12_command_list for (i = 0; i < dispatch_count; i++) { struct dispatch_entry *d = &dispatches[i]; - memset(query_map, 0, sizeof(*query_map) * query_map_size); + if (i != 0) + memset(query_map, 0, sizeof(*query_map) * query_map_size); /* First pass that counts unique queries since the compute * shader expects list heads to be packed first in the array */