From 11dd9e4ee4a5241ee18cfe68d8bee2ee3da55dc7 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 14 Oct 2021 10:13:25 -0400 Subject: [PATCH] zink: use static array for detecting VK_TIME_DOMAIN_DEVICE_EXT there's only a few possible values for this, so just use a static array to avoid leaking Fixes: 039078fe972 ("zink: slight refactor of load_device_extensions()") Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_screen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 5f574010bba..10207633c0a 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -1337,10 +1337,11 @@ static bool check_have_device_time(struct zink_screen *screen) { uint32_t num_domains = 0; + VkTimeDomainEXT domains[8]; //current max is 4 VKSCR(GetPhysicalDeviceCalibrateableTimeDomainsEXT)(screen->pdev, &num_domains, NULL); assert(num_domains > 0); + assert(num_domains < ARRAY_SIZE(domains)); - VkTimeDomainEXT *domains = malloc(sizeof(VkTimeDomainEXT) * num_domains); VKSCR(GetPhysicalDeviceCalibrateableTimeDomainsEXT)(screen->pdev, &num_domains, domains); /* VK_TIME_DOMAIN_DEVICE_EXT is used for the ctx->get_timestamp hook and is the only one we really need */ @@ -1350,7 +1351,6 @@ check_have_device_time(struct zink_screen *screen) } } - free(domains); return false; }