Skip to content

Commit 0cc7c8a

Browse files
committed
fix : Dangling pointer for non-empty trigger words in llama_sampler_init_grammar_impl (#17047)
1 parent b7f9010 commit 0cc7c8a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/llama-sampling.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1637,7 +1637,7 @@ static struct llama_sampler * llama_sampler_init_grammar_impl(
16371637
trigger_pattern += std::regex_replace(trigger_words[i], special_chars, "\\$0");
16381638
}
16391639
trigger_pattern += ")[\\s\\S]*";
1640-
const auto * trigger_pattern_c = trigger_pattern.c_str();
1640+
static const auto * trigger_pattern_c = trigger_pattern.c_str();
16411641
trigger_patterns = &trigger_pattern_c;
16421642
num_trigger_patterns = 1;
16431643
}

0 commit comments

Comments
 (0)