]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
server : fix free of spec context and batch (#10651)
authorGeorgi Gerganov <redacted>
Sat, 7 Dec 2024 09:52:44 +0000 (11:52 +0200)
committerGitHub <redacted>
Sat, 7 Dec 2024 09:52:44 +0000 (11:52 +0200)
ggml-ci

common/speculative.cpp
examples/server/server.cpp

index e559675c436ef7071a48c30f2564185137cdd435..3fcbb0020b6afe5b5b1b87bca0c8305220206beb 100644 (file)
@@ -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);
index 809fafa187add92a068419867046c29ee3fbc8d4..d57a296a2de07e9a42e98189ebff428ffe336028 100644 (file)
@@ -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;