]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.3241: Vim9: memory leak when function reports an error v8.2.3241
authorBram Moolenaar <Bram@vim.org>
Wed, 28 Jul 2021 20:21:23 +0000 (22:21 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 28 Jul 2021 20:21:23 +0000 (22:21 +0200)
Problem:    Vim9: memory leak when function reports an error.
Solution:   Clear the return value.

src/userfunc.c
src/version.c

index 2adef7c18aaabde932df993a24c72e58cc7711e9..045692c7f1ebc036bc4216b64f0b542bdca2f0e3 100644 (file)
@@ -1691,9 +1691,12 @@ get_func_tv(
 
        ret = call_func(name, len, rettv, argcount, argvars, funcexe);
        if (in_vim9script() && did_emsg > did_emsg_before)
+       {
            // An error in a builtin function does not return FAIL, but we do
            // want to abort further processing if an error was given.
            ret = FAIL;
+           clear_tv(rettv);
+       }
 
        funcargs.ga_len -= i;
     }
index 13b6425dc8c0bc5851e0e73f9091f32ea0c4c8db..897e3fb95f76b59ba50118dd36d70345c7cba205 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3241,
 /**/
     3240,
 /**/