Parcourir la source

server : fix free of spec context and batch (#10651)

ggml-ci
Georgi Gerganov il y a 1 an
Parent
commit
c2a16c0bdb
2 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 4 0
      common/speculative.cpp
  2. 1 1
      examples/server/server.cpp

+ 4 - 0
common/speculative.cpp

@@ -62,6 +62,10 @@ struct common_speculative * common_speculative_init(
 }
 }
 
 
 void common_speculative_free(struct common_speculative * spec) {
 void common_speculative_free(struct common_speculative * spec) {
+    if (spec == nullptr) {
+        return;
+    }
+
     common_sampler_free(spec->smpl);
     common_sampler_free(spec->smpl);
 
 
     llama_batch_free(spec->batch);
     llama_batch_free(spec->batch);

+ 1 - 1
examples/server/server.cpp

@@ -720,7 +720,7 @@ struct server_slot {
     int id;
     int id;
     int id_task = -1;
     int id_task = -1;
 
 
-    llama_batch batch_spec;
+    llama_batch batch_spec = {};
 
 
     llama_context * ctx_dft = nullptr;
     llama_context * ctx_dft = nullptr;