From c2a16c0bdbe2e51adf318918bad82f0c3e3d6f3b Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sat, 7 Dec 2024 11:52:44 +0200 Subject: [PATCH] server : fix free of spec context and batch (#10651) ggml-ci --- common/speculative.cpp | 4 ++++ examples/server/server.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/common/speculative.cpp b/common/speculative.cpp index e559675c4..3fcbb0020 100644 --- a/common/speculative.cpp +++ b/common/speculative.cpp @@ -62,6 +62,10 @@ struct common_speculative * common_speculative_init( } void common_speculative_free(struct common_speculative * spec) { + if (spec == nullptr) { + return; + } + common_sampler_free(spec->smpl); llama_batch_free(spec->batch); diff --git a/examples/server/server.cpp b/examples/server/server.cpp index 809fafa18..d57a296a2 100644 --- a/examples/server/server.cpp +++ b/examples/server/server.cpp @@ -720,7 +720,7 @@ struct server_slot { int id; int id_task = -1; - llama_batch batch_spec; + llama_batch batch_spec = {}; llama_context * ctx_dft = nullptr;