]> granicus.if.org Git - vim/commitdiff
patch 8.2.1860: Vim9: memory leak when throwing empty string v8.2.1860
authorBram Moolenaar <Bram@vim.org>
Sat, 17 Oct 2020 20:58:21 +0000 (22:58 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 17 Oct 2020 20:58:21 +0000 (22:58 +0200)
Problem:    Vim9: memory leak when throwing empty string.
Solution:   Free the empty string.

src/version.c
src/vim9execute.c

index 342ad7cd933ec13df95fef2949b2366d1e99534d..7720998fc1e5cf5cd3b06bdd35706abac7334efe 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1860,
 /**/
     1859,
 /**/
index 31b67d183af5fdc70ca99d344f0f69666d1dd89e..673bf91c43be399f8a39fc4e40789e53aa03527b 100644 (file)
@@ -2094,6 +2094,7 @@ call_def_function(
                if (tv->vval.v_string == NULL
                                       || *skipwhite(tv->vval.v_string) == NUL)
                {
+                   vim_free(tv->vval.v_string);
                    emsg(_(e_throw_with_empty_string));
                    goto failed;
                }