]> granicus.if.org Git - vim/commitdiff
patch 8.2.1971: memory leak when map() fails v8.2.1971
authorBram Moolenaar <Bram@vim.org>
Tue, 10 Nov 2020 10:43:56 +0000 (11:43 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 10 Nov 2020 10:43:56 +0000 (11:43 +0100)
Problem:    Memory leak when map() fails.
Solution:   Clear the typval.

src/list.c
src/version.c

index 866de187183b2305afebcb500f74cd74956a9c3e..b62c14164f2b67b5b8ebd4ede5bef01108c380d0 100644 (file)
@@ -2185,8 +2185,13 @@ filter_map(typval_T *argvars, typval_T *rettv, filtermap_T filtermap)
                nli = li->li_next;
                set_vim_var_nr(VV_KEY, idx);
                if (filter_map_one(&li->li_tv, expr, filtermap,
-                                            &newtv, &rem) == FAIL || did_emsg)
+                                                        &newtv, &rem) == FAIL)
                    break;
+               if (did_emsg)
+               {
+                   clear_tv(&newtv);
+                   break;
+               }
                if (filtermap == FILTERMAP_MAP)
                {
                    // map(): replace the list item value
index 8cf37f0adebf170e84d0ccde60c100fa2ebe9d5f..91477bcef2b73734a59d6f4659cd32e17f796039 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1971,
 /**/
     1970,
 /**/