From 4d646f8f133c4c26a1789bbc6ae4484d52bed55f Mon Sep 17 00:00:00 2001 From: Steve Grubb Date: Tue, 14 May 2024 10:05:26 -0400 Subject: [PATCH] common: free ctx_gguf when exiting llama_control_vector_load_one ctx_gguf is initialized by gguf_init_from_file. It appears to be otherwise unused throughout the function. Someone more familar with the code might want to consider if gguf_init_from_file is necessary at all. But in the mean time, free the context when exiting so we don't leak memory. --- common/common.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/common.cpp b/common/common.cpp index 96130ad54..63c92e17f 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -2977,6 +2977,8 @@ static llama_control_vector_data llama_control_vector_load_one(const llama_contr } } + gguf_free(ctx_gguf); + return result; }