]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
ggml : fix ggml_used_mem() (#1264)
authorKerfuffle <redacted>
Mon, 1 May 2023 11:56:07 +0000 (05:56 -0600)
committerGitHub <redacted>
Mon, 1 May 2023 11:56:07 +0000 (14:56 +0300)
ggml.c

diff --git a/ggml.c b/ggml.c
index 8cc48344ea4bc7fac832965b3f8886015c84465a..5b5ed925e455a5bdea284d5ead1619e2a48fc5d2 100644 (file)
--- a/ggml.c
+++ b/ggml.c
@@ -4411,7 +4411,7 @@ void ggml_free(struct ggml_context * ctx) {
 }
 
 size_t ggml_used_mem(const struct ggml_context * ctx) {
-    return ctx->objects_end->offs + ctx->objects_end->size;
+    return ctx->objects_end == NULL ? 0 : ctx->objects_end->offs + ctx->objects_end->size;
 }
 
 size_t ggml_set_scratch(struct ggml_context * ctx, struct ggml_scratch scratch) {