sampling : null grammar field after reset (#3885)

This commit is contained in:
l3utterfly 2023-11-01 21:40:43 +08:00 committed by GitHub
parent 9a3b4f6c86
commit e75dfdd31b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,6 +39,7 @@ void llama_sampling_free(struct llama_sampling_context * ctx) {
void llama_sampling_reset(llama_sampling_context * ctx) { void llama_sampling_reset(llama_sampling_context * ctx) {
if (ctx->grammar != NULL) { if (ctx->grammar != NULL) {
llama_grammar_free(ctx->grammar); llama_grammar_free(ctx->grammar);
ctx->grammar = NULL;
} }
if (!ctx->parsed_grammar.rules.empty()) { if (!ctx->parsed_grammar.rules.empty()) {