diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-12-25 14:13:03 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-12-25 14:13:03 +0100 |
commit | 6c52f8237199ea09abbecdc5b89847c5889c3de1 (patch) | |
tree | f4319d9589f13a2038af25473f08bce94800804f | |
parent | 03af01f1cb03423f1a1a6b19f11f0285d81e12c4 (diff) | |
download | vim-git-6c52f8237199ea09abbecdc5b89847c5889c3de1.tar.gz |
patch 8.2.0041: leaking memory when selecting spell suggestionv8.2.0041
Problem: Leaking memory when selecting spell suggestion.
Solution: Free previous value at the right time.
-rw-r--r-- | src/spellsuggest.c | 9 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/spellsuggest.c b/src/spellsuggest.c index adf090bbe..fdd549e47 100644 --- a/src/spellsuggest.c +++ b/src/spellsuggest.c @@ -540,14 +540,10 @@ spell_suggest(int count) else if (count > 0) { if (count > sug.su_ga.ga_len) - smsg(_("Sorry, only %ld suggestions"), - (long)sug.su_ga.ga_len); + smsg(_("Sorry, only %ld suggestions"), (long)sug.su_ga.ga_len); } else { - VIM_CLEAR(repl_from); - VIM_CLEAR(repl_to); - #ifdef FEAT_RIGHTLEFT // When 'rightleft' is set the list is drawn right-left. cmdmsg_rl = curwin->w_p_rl; @@ -641,6 +637,9 @@ 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. + VIM_CLEAR(repl_from); + VIM_CLEAR(repl_to); + stp = &SUG(sug.su_ga, selected - 1); if (sug.su_badlen > stp->st_orglen) { diff --git a/src/version.c b/src/version.c index aeadb364f..8ea652d5d 100644 --- a/src/version.c +++ b/src/version.c @@ -743,6 +743,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 41, +/**/ 40, /**/ 39, |