From 1e7ea180268668880b2f3fff853d1f071da04492 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Mon, 2 May 2022 16:32:36 +0300 Subject: [PATCH] vulkan/runtime: 0-out pipeline cache object I'm running into crashes because cache->cache_object is uninitialized. Signed-off-by: Lionel Landwerlin Fixes: 591da9877900 ("vulkan: Add a common VkPipelineCache implementation") Reviewed-by: Jason Ekstrand Part-of: --- src/vulkan/runtime/vk_pipeline_cache.c | 4 ++-- src/vulkan/runtime/vk_pipeline_cache.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vulkan/runtime/vk_pipeline_cache.c b/src/vulkan/runtime/vk_pipeline_cache.c index 87310eb..6ed7a39 100644 --- a/src/vulkan/runtime/vk_pipeline_cache.c +++ b/src/vulkan/runtime/vk_pipeline_cache.c @@ -562,8 +562,8 @@ vk_pipeline_cache_create(struct vk_device *device, assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO); - cache = vk_object_alloc(device, pAllocator, sizeof(*cache), - VK_OBJECT_TYPE_PIPELINE_CACHE); + cache = vk_object_zalloc(device, pAllocator, sizeof(*cache), + VK_OBJECT_TYPE_PIPELINE_CACHE); if (cache == NULL) return NULL; diff --git a/src/vulkan/runtime/vk_pipeline_cache.h b/src/vulkan/runtime/vk_pipeline_cache.h index 2d1eeb1..37fe2e7 100644 --- a/src/vulkan/runtime/vk_pipeline_cache.h +++ b/src/vulkan/runtime/vk_pipeline_cache.h @@ -120,6 +120,7 @@ vk_pipeline_cache_object_init(struct vk_device *device, const struct vk_pipeline_cache_object_ops *ops, const void *key_data, uint32_t key_size) { + memset(object, 0, sizeof(*object)); object->device = device; object->ops = ops; p_atomic_set(&object->ref_cnt, 1); -- 2.7.4