Skip to content

Commit 6e850a6

Browse files
committed
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.
1 parent 2a4bd00 commit 6e850a6

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/userfunc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,9 +1691,12 @@ get_func_tv(
16911691

16921692
ret = call_func(name, len, rettv, argcount, argvars, funcexe);
16931693
if (in_vim9script() && did_emsg > did_emsg_before)
1694+
{
16941695
// An error in a builtin function does not return FAIL, but we do
16951696
// want to abort further processing if an error was given.
16961697
ret = FAIL;
1698+
clear_tv(rettv);
1699+
}
16971700

16981701
funcargs.ga_len -= i;
16991702
}

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ static char *(features[]) =
755755

756756
static int included_patches[] =
757757
{ /* Add new patch number below this line */
758+
/**/
759+
3241,
758760
/**/
759761
3240,
760762
/**/

0 commit comments

Comments
 (0)