vulkan: the index in ggml_vk_host_free could be uinitialized if pinned_memory.size() is zero

This commit is contained in:
FirstTimeEZ 2024-11-16 20:24:46 +13:00
parent dd3a6ce9f8
commit 6beb50dbf6
No known key found for this signature in database

View file

@ -2208,7 +2208,7 @@ static void ggml_vk_host_free(vk_device& device, void* ptr) {
}
VK_LOG_MEMORY("ggml_vk_host_free(" << ptr << ")");
vk_buffer buf;
size_t index;
size_t index = 0;
for (size_t i = 0; i < device->pinned_memory.size(); i++) {
const uint8_t* addr = (const uint8_t*) std::get<0>(device->pinned_memory[i]);
const uint8_t* endr = addr + std::get<1>(device->pinned_memory[i]);