1
0
Fork 0
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:
niansa 2023-04-23 16:08:34 +02:00
parent 5391dec731
commit 024d7a06ce

View file

@ -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);