summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorl3utterfly <gc.pthzfoldr@gmail.com>2023-11-01 21:40:43 +0800
committerGitHub <noreply@github.com>2023-11-01 15:40:43 +0200
commite75dfdd31b6a3dfa0627ba4ac3bb4b36e9db588e (patch)
treee5960656ca67033c22232eafa7d6a4aeec7f0ecc
parent9a3b4f6c86503c9cfc049d4d0fdeafef12806f5e (diff)
sampling : null grammar field after reset (#3885)
-rw-r--r--common/sampling.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/common/sampling.cpp b/common/sampling.cpp
index 673d67a6..1317024c 100644
--- a/common/sampling.cpp
+++ b/common/sampling.cpp
@@ -39,6 +39,7 @@ void llama_sampling_free(struct llama_sampling_context * ctx) {
void llama_sampling_reset(llama_sampling_context * ctx) {
if (ctx->grammar != NULL) {
llama_grammar_free(ctx->grammar);
+ ctx->grammar = NULL;
}
if (!ctx->parsed_grammar.rules.empty()) {