summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-07-28 22:21:23 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-28 22:21:23 +0200
commit6e850a6900793e215c08b39d6490173488cb05ce (patch)
tree03a360f240bdd152b4580d348fd948de396cd1c4
parent2a4bd00cef1a291059903e26a126b84718e47804 (diff)
downloadvim-git-6e850a6900793e215c08b39d6490173488cb05ce.tar.gz
patch 8.2.3241: Vim9: memory leak when function reports an errorv8.2.3241
Problem: Vim9: memory leak when function reports an error. Solution: Clear the return value.
-rw-r--r--src/userfunc.c3
-rw-r--r--src/version.c2
2 files changed, 5 insertions, 0 deletions
diff --git a/src/userfunc.c b/src/userfunc.c
index 2adef7c18..045692c7f 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -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;
}
diff --git a/src/version.c b/src/version.c
index 13b6425dc..897e3fb95 100644
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3241,
+/**/
3240,
/**/
3239,