From 2cadab5dcf3bdff4e52395eac6d04daba7ccdda0 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Tue, 5 Nov 2024 15:42:26 +0200 Subject: [PATCH] vulkan/runtime: fix allocation failure handling Signed-off-by: Lionel Landwerlin Fixes: 93d0c66b27 ("vulkan/pipeline_cache: Add helpers for storing NIR in the cache") Reviewed-by: Ivan Briano Part-of: --- src/vulkan/runtime/vk_pipeline_cache.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vulkan/runtime/vk_pipeline_cache.c b/src/vulkan/runtime/vk_pipeline_cache.c index c38855ac528..d7f7d776446 100644 --- a/src/vulkan/runtime/vk_pipeline_cache.c +++ b/src/vulkan/runtime/vk_pipeline_cache.c @@ -518,6 +518,10 @@ vk_pipeline_cache_add_nir(struct vk_pipeline_cache *cache, key_data, key_size, blob.data, blob.size); blob_finish(&blob); + if (data_obj == NULL) { + vk_pipeline_cache_log(cache, "Ran out of memory creating NIR shader"); + return; + } struct vk_pipeline_cache_object *cached = vk_pipeline_cache_add_object(cache, &data_obj->base);