Commit 6f5ff495 by Nicolas Capens Committed by Nicolas Capens

Fix deallocation of uninitialized pointer

When pCreateInfo->setLayoutCount is 0, descriptorSets[0].bindings would not be assigned the initial bindingStorage value, which is the start of the additional memory that is allocated for the PipelineLayout object. It is used in PipelineLayout::destroy() for deallocating said memory, which leads to attempting to free an initialized pointer. This was a regression caused by https://swiftshader-review.googlesource.com/c/SwiftShader/+/44328 Bug: b/154522740 Change-Id: I98f63d58e9d64b36f15d966afd1bc70c1ec97f59 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/45448 Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarTrevor Black <vantablack@google.com>
parent 471c120a
......@@ -28,6 +28,9 @@ PipelineLayout::PipelineLayout(const VkPipelineLayoutCreateInfo *pCreateInfo, vo
{
Binding *bindingStorage = reinterpret_cast<Binding *>(mem);
uint32_t dynamicOffsetIndex = 0;
descriptorSets[0].bindings = bindingStorage; // Used in destroy() for deallocation.
for(uint32_t i = 0; i < pCreateInfo->setLayoutCount; i++)
{
const vk::DescriptorSetLayout *setLayout = vk::Cast(pCreateInfo->pSetLayouts[i]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment