Skip to content

Commit 6beb50d

Browse files
committed
vulkan: the index in ggml_vk_host_free could be uinitialized if pinned_memory.size() is zero
1 parent dd3a6ce commit 6beb50d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ggml/src/ggml-vulkan/ggml-vulkan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2208,7 +2208,7 @@ static void ggml_vk_host_free(vk_device& device, void* ptr) {
22082208
}
22092209
VK_LOG_MEMORY("ggml_vk_host_free(" << ptr << ")");
22102210
vk_buffer buf;
2211-
size_t index;
2211+
size_t index = 0;
22122212
for (size_t i = 0; i < device->pinned_memory.size(); i++) {
22132213
const uint8_t* addr = (const uint8_t*) std::get<0>(device->pinned_memory[i]);
22142214
const uint8_t* endr = addr + std::get<1>(device->pinned_memory[i]);

0 commit comments

Comments
 (0)