浏览代码

sampling : null grammar field after reset (#3885)

l3utterfly 2 年之前
父节点
当前提交
e75dfdd31b
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      common/sampling.cpp

+ 1 - 0
common/sampling.cpp

@@ -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()) {