Skip to content

Commit be4a6a6

Browse files
authored
server : check draft context creation error (ggml-org#24922)
1 parent 72a9269 commit be4a6a6

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

tools/server/server-context.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ struct server_batch {
8989
}
9090

9191
~server_batch() {
92-
llama_batch_free(batch);
92+
if (batch.token != nullptr) {
93+
llama_batch_free(batch);
94+
}
9395
}
9496

9597
void init(int32_t n_tokens_alloc) {
@@ -1215,6 +1217,10 @@ struct server_context_impl {
12151217
cparams.ctx_other = ctx_tgt;
12161218

12171219
ctx_dft.reset(llama_init_from_model(model_dft.get(), cparams));
1220+
if (ctx_dft == nullptr) {
1221+
SRV_ERR("%s", "failed to create draft context\n");
1222+
return false;
1223+
}
12181224

12191225
params_base.speculative.draft.ctx_tgt = ctx_tgt;
12201226
params_base.speculative.draft.ctx_dft = ctx_dft.get();

0 commit comments

Comments
 (0)