Skip to content

Commit

Permalink
patch 8.2.0041: leaking memory when selecting spell suggestion
Browse files Browse the repository at this point in the history
Problem:    Leaking memory when selecting spell suggestion.
Solution:   Free previous value at the right time.
  • Loading branch information
brammool committed Dec 25, 2019
1 parent 03af01f commit 6c52f82
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/spellsuggest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
41,
/**/
40,
/**/
Expand Down

0 comments on commit 6c52f82

Please sign in to comment.