From e77b064b70d49ef877456bc93f9d17e37ef9e1d0 Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Fri, 21 Mar 2025 12:26:27 -0500 Subject: render: vulkan: add check for null pointer for debug Add a check for a NULL pointer during initialization of debugging extensions. Signed-off-by: Danny Holman --- render/vulkan/context.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/render/vulkan/context.c b/render/vulkan/context.c index 22003bf..1282706 100644 --- a/render/vulkan/context.c +++ b/render/vulkan/context.c @@ -173,7 +173,13 @@ void destroy_vkcontext(vkcontext_t *context) { } vklayer_container_t* init_vklayers(ext_container_t *ext) { - const char** new_extensions = rune_alloc(sizeof(char*) * ext->ext_count++); + ext->ext_count++; + const char** new_extensions = rune_alloc(sizeof(char*) * ext->ext_count); + if (new_extensions == NULL) { + log_output(LOG_FATAL, "Cannot allocate memory for debug extensions"); + rune_abort(); + } + for (uint32_t i = 0; i < ext->ext_count-1; i++) new_extensions[i] = ext->extensions[i]; new_extensions[ext->ext_count-1] = VK_EXT_DEBUG_UTILS_EXTENSION_NAME; -- cgit v1.2.3