vulkan: avoid double-free in InitSharedPtr
When std::shared_ptr fails to allocate its internal data, it deletes the
managed object automatically. We should not call obj->common.decRef on
std::bad_alloc.
Bug: 28039233
Change-Id: I1fe00c16e83e426602eac96d8b86afb4fd4830e6
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp
index 7f944cf..ee52857 100644
--- a/vulkan/libvulkan/swapchain.cpp
+++ b/vulkan/libvulkan/swapchain.cpp
@@ -102,7 +102,6 @@
obj, NativeBaseDeleter<T>(),
VulkanAllocator<T>(*GetAllocator(host), AllocScope<Host>::kScope));
} catch (std::bad_alloc&) {
- obj->common.decRef(&obj->common);
return nullptr;
}
}