vulkan : initialize vk_buffer_struct members to VK_NULL_HANDLE (ggml/893)

This prevents invalid frees when destroying a partially initialized
vk_buffer_struct. For example, this could happen in ggml_vk_create_buffer
when running out of device memory.

Co-authored-by: Tony Wasserka <neobrain@users.noreply.github.com>
This commit is contained in:
Tony Wasserka 2024-07-20 20:49:44 +02:00 committed by Georgi Gerganov
parent ab8ec9e940
commit 8da6fd4dff

View File

@ -238,8 +238,8 @@ struct vk_device_struct {
}; };
struct vk_buffer_struct { struct vk_buffer_struct {
vk::Buffer buffer; vk::Buffer buffer = VK_NULL_HANDLE;
vk::DeviceMemory device_memory; vk::DeviceMemory device_memory = VK_NULL_HANDLE;
vk::MemoryPropertyFlags memory_property_flags; vk::MemoryPropertyFlags memory_property_flags;
void * ptr; void * ptr;
size_t size = 0; size_t size = 0;