summaryrefslogtreecommitdiff
path: root/examples/gguf
diff options
context:
space:
mode:
authorSteve Grubb <ausearch.1@gmail.com>2024-03-14 14:29:32 -0400
committerGitHub <noreply@github.com>2024-03-14 20:29:32 +0200
commit6e0438da3cc95b89cdbf55f45fa4e324d9076792 (patch)
tree82e2e752df7c50b24aba8459e935ac83309214fb /examples/gguf
parent727107707a73b3dc8a497cf9fc9405722c16dd2b (diff)
gguf : fix resource leaks (#6061)
There several places where a gguf context is allocated. A call to gguf_free is missing in some error paths. Also on linux, llama-bench was missing a fclose.
Diffstat (limited to 'examples/gguf')
-rw-r--r--examples/gguf/gguf.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/examples/gguf/gguf.cpp b/examples/gguf/gguf.cpp
index e67be4fb..5444503a 100644
--- a/examples/gguf/gguf.cpp
+++ b/examples/gguf/gguf.cpp
@@ -211,6 +211,7 @@ static bool gguf_ex_read_1(const std::string & fname) {
for (int j = 0; j < ggml_nelements(cur); ++j) {
if (data[j] != 100 + i) {
fprintf(stderr, "%s: tensor[%d]: data[%d] = %f\n", __func__, i, j, data[j]);
+ gguf_free(ctx);
return false;
}
}