mirror of
https://github.com/Dushistov/sdcv.git
synced 2025-12-15 17:31:56 +00:00
fix: memory leak instroduced in #110
This commit is contained in:
committed by
Evgeniy Dushistov
parent
d5e1eb4d93
commit
849f0ed1ac
@@ -1047,10 +1047,11 @@ bool Libs::LookupSimilarWord(const gchar *sWord, std::set<glong> &iWordIndices,
|
|||||||
}
|
}
|
||||||
// Upper the first character and lower others.
|
// Upper the first character and lower others.
|
||||||
if (!bFound) {
|
if (!bFound) {
|
||||||
const gchar *nextchar = g_utf8_next_char(sWord);
|
const gchar *rest = g_utf8_next_char(sWord);
|
||||||
gchar *firstchar = g_utf8_strup(sWord, nextchar - sWord);
|
gchar *firstchar = g_utf8_strup(sWord, rest - sWord);
|
||||||
nextchar = g_utf8_strdown(nextchar, -1);
|
gchar *rest_lowercase = g_utf8_strdown(rest, -1);
|
||||||
casestr = g_strdup_printf("%s%s", firstchar, nextchar);
|
casestr = g_strdup_printf("%s%s", firstchar, rest_lowercase);
|
||||||
|
g_free(rest_lowercase);
|
||||||
g_free(firstchar);
|
g_free(firstchar);
|
||||||
if (strcmp(casestr, sWord)) {
|
if (strcmp(casestr, sWord)) {
|
||||||
if (oLib[iLib]->Lookup(casestr, iWordIndices))
|
if (oLib[iLib]->Lookup(casestr, iWordIndices))
|
||||||
|
|||||||
Reference in New Issue
Block a user