changeset 25409:e3f1086429d8 v8.2.3241

patch 8.2.3241: Vim9: memory leak when function reports an error Commit: https://github.com/vim/vim/commit/6e850a6900793e215c08b39d6490173488cb05ce Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jul 28 22:21:23 2021 +0200 patch 8.2.3241: Vim9: memory leak when function reports an error Problem: Vim9: memory leak when function reports an error. Solution: Clear the return value.
author Bram Moolenaar <Bram@vim.org>
date Wed, 28 Jul 2021 22:30:04 +0200
parents 58603ea67d8e
children e5630f3134a3
files src/userfunc.c src/version.c
diffstat 2 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;
     }
--- 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,