server: error handling: fix double free of ctx_sampling

This commit is contained in:
ZXED 2024-03-09 12:01:23 +03:00
parent 444f32e370
commit a4f25f8793
No known key found for this signature in database
GPG key ID: 637FB44813DCFD66

View file

@ -958,6 +958,7 @@ struct server_context {
{ {
if (slot.ctx_sampling != nullptr) { if (slot.ctx_sampling != nullptr) {
llama_sampling_free(slot.ctx_sampling); llama_sampling_free(slot.ctx_sampling);
slot.ctx_sampling = nullptr;
} }
slot.ctx_sampling = llama_sampling_init(slot.sparams); slot.ctx_sampling = llama_sampling_init(slot.sparams);
llama_set_rng_seed(ctx, slot.params.seed); llama_set_rng_seed(ctx, slot.params.seed);