mirror of
https://github.com/neovim/neovim.git
synced 2025-10-04 08:56:29 +00:00
vim-patch:8.2.0041: leaking memory when selecting spell suggestion
Problem: Leaking memory when selecting spell suggestion.
Solution: Free previous value at the right time.
6c52f82371
This commit is contained in:
@@ -2827,9 +2827,6 @@ void spell_suggest(int count)
|
|||||||
smsg(_("Sorry, only %" PRId64 " suggestions"),
|
smsg(_("Sorry, only %" PRId64 " suggestions"),
|
||||||
(int64_t)sug.su_ga.ga_len);
|
(int64_t)sug.su_ga.ga_len);
|
||||||
} else {
|
} else {
|
||||||
XFREE_CLEAR(repl_from);
|
|
||||||
XFREE_CLEAR(repl_to);
|
|
||||||
|
|
||||||
// When 'rightleft' is set the list is drawn right-left.
|
// When 'rightleft' is set the list is drawn right-left.
|
||||||
cmdmsg_rl = curwin->w_p_rl;
|
cmdmsg_rl = curwin->w_p_rl;
|
||||||
if (cmdmsg_rl)
|
if (cmdmsg_rl)
|
||||||
@@ -2909,6 +2906,9 @@ void spell_suggest(int count)
|
|||||||
|
|
||||||
if (selected > 0 && selected <= sug.su_ga.ga_len && u_save_cursor() == OK) {
|
if (selected > 0 && selected <= sug.su_ga.ga_len && u_save_cursor() == OK) {
|
||||||
// Save the from and to text for :spellrepall.
|
// Save the from and to text for :spellrepall.
|
||||||
|
XFREE_CLEAR(repl_from);
|
||||||
|
XFREE_CLEAR(repl_to);
|
||||||
|
|
||||||
stp = &SUG(sug.su_ga, selected - 1);
|
stp = &SUG(sug.su_ga, selected - 1);
|
||||||
if (sug.su_badlen > stp->st_orglen) {
|
if (sug.su_badlen > stp->st_orglen) {
|
||||||
// Replacing less than "su_badlen", append the remainder to
|
// Replacing less than "su_badlen", append the remainder to
|
||||||
|
Reference in New Issue
Block a user