]> granicus.if.org Git - vim/commitdiff
patch 8.2.0041: leaking memory when selecting spell suggestion v8.2.0041
authorBram Moolenaar <Bram@vim.org>
Wed, 25 Dec 2019 13:13:03 +0000 (14:13 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 25 Dec 2019 13:13:03 +0000 (14:13 +0100)
Problem:    Leaking memory when selecting spell suggestion.
Solution:   Free previous value at the right time.

src/spellsuggest.c
src/version.c

index adf090bbe59febdd4430ec2fe52c139a916640e7..fdd549e47553616f851042d0f0c86bac837874e1 100644 (file)
@@ -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)
        {
index aeadb364f59da2311fd933ed6e6083f34877641d..8ea652d5d29ba764994b4a2b8798ece63270a505 100644 (file)
@@ -742,6 +742,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    41,
 /**/
     40,
 /**/