mirror of
https://gitlab.com/niansa/discord_llama.git
synced 2025-03-06 20:48:25 +01:00
Fixed memory leak during translation
This commit is contained in:
parent
5391dec731
commit
024d7a06ce
1 changed files with 1 additions and 0 deletions
1
main.cpp
1
main.cpp
|
@ -38,6 +38,7 @@ std::vector<std::string_view> str_split(std::string_view s, char delimiter, size
|
|||
static
|
||||
void str_replace_in_place(std::string& subject, std::string_view search,
|
||||
const std::string& replace) {
|
||||
if (search.empty()) return;
|
||||
size_t pos = 0;
|
||||
while ((pos = subject.find(search, pos)) != std::string::npos) {
|
||||
subject.replace(pos, search.length(), replace);
|
||||
|
|
Loading…
Add table
Reference in a new issue