server: free sampling contexts on exit (#7264)

* server: free sampling contexts on exit

This cleans up last leak found by the address sanitizer.

* fix whitespace

* fix whitespace
This commit is contained in:
Steve Grubb 2024-05-14 10:11:24 -04:00 committed by teleprint-me
parent 04a7f32a53
commit 58962a298b
No known key found for this signature in database
GPG key ID: B0D11345E65C4D48

View file

@ -671,6 +671,13 @@ struct server_context {
model = nullptr;
}
// Clear any sampling context
for (server_slot & slot : slots) {
if (slot.ctx_sampling != nullptr) {
llama_sampling_free(slot.ctx_sampling);
}
}
llama_batch_free(batch);
}