llama.cpp
llama.cpp copied to clipboard
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.
There are more leaks in this function. #6289 has the fixes.
do we use valgrind here and should we?
This particular one was found by static analysis. The others I sent recently were found by ASAN. It's a lot faster than valgrind.
@stevegrubb looks like it might take a while for https://github.com/ggerganov/llama.cpp/pull/6289 to be merged in.
You may want to check if any of the leaks fixes from there is directly related to this PR and move it over, then it would make sense to merge this in.
@mofosyne looks like the referenced patch contains the fix. My personal taste is not to mix features and bug fixes so that bug fixes can be cherry picked if needed. I'll close this.