diff options
author | Danny Holman <dholman@gymli.org> | 2025-03-21 12:26:27 -0500 |
---|---|---|
committer | Danny Holman <dholman@gymli.org> | 2025-03-21 12:26:27 -0500 |
commit | e77b064b70d49ef877456bc93f9d17e37ef9e1d0 (patch) | |
tree | 7098660d72782d91896baf8fd76104dad6e54848 | |
parent | 6c0bd285dd3dcd1c183abea15122ea5af0657757 (diff) |
Add a check for a NULL pointer during initialization of debugging
extensions.
Signed-off-by: Danny Holman <dholman@gymli.org>
-rw-r--r-- | render/vulkan/context.c | 8 |
1 files changed, 7 insertions, 1 deletions
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; |