diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-03-15 23:26:05 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-04-13 12:00:31 -0400 |
commit | 5be72756f87f9ecf8931b9c4ff192a5aae4edadd (patch) | |
tree | 55d8fc1c2a571dfa181f7561e4e56fca463ce91b /src | |
parent | d2abd1be80774f13416f566a1e8448635f1cf5e6 (diff) | |
download | rneovim-5be72756f87f9ecf8931b9c4ff192a5aae4edadd.tar.gz rneovim-5be72756f87f9ecf8931b9c4ff192a5aae4edadd.tar.bz2 rneovim-5be72756f87f9ecf8931b9c4ff192a5aae4edadd.zip |
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.
https://github.com/vim/vim/commit/6c52f8237199ea09abbecdc5b89847c5889c3de1
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/spell.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 545a381bd3..180073ade1 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -2827,9 +2827,6 @@ void spell_suggest(int count) smsg(_("Sorry, only %" PRId64 " suggestions"), (int64_t)sug.su_ga.ga_len); } else { - XFREE_CLEAR(repl_from); - XFREE_CLEAR(repl_to); - // When 'rightleft' is set the list is drawn right-left. cmdmsg_rl = curwin->w_p_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) { // Save the from and to text for :spellrepall. + XFREE_CLEAR(repl_from); + XFREE_CLEAR(repl_to); + stp = &SUG(sug.su_ga, selected - 1); if (sug.su_badlen > stp->st_orglen) { // Replacing less than "su_badlen", append the remainder to |