From 2bdc09646d8c6cb74a6f573e9081586b4b83b9d1 Mon Sep 17 00:00:00 2001 From: Kerfuffle <44031344+KerfuffleV2@users.noreply.github.com> Date: Mon, 1 May 2023 05:56:07 -0600 Subject: [PATCH] ggml : fix ggml_used_mem() (#1264) --- ggml.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ggml.c b/ggml.c index 8cc48344e..5b5ed925e 100644 --- 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) {