Skip to content

Commit 518df27

Browse files
committed
patch 8.2.2953: Vim9: leaking memory when using heredoc script
Problem: Vim9: leaking memory when using heredoc script. Solution: Free the first line.
1 parent 9928555 commit 518df27

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/version.c

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

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2953,
753755
/**/
754756
2952,
755757
/**/

src/vim9execute.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,17 +1460,23 @@ exec_instructions(ectx_T *ectx)
14601460
case ISN_EXEC_SPLIT:
14611461
{
14621462
source_cookie_T cookie;
1463+
char_u *line;
14631464

14641465
SOURCING_LNUM = iptr->isn_lnum;
14651466
CLEAR_FIELD(cookie);
14661467
cookie.sourcing_lnum = iptr->isn_lnum - 1;
14671468
cookie.nextline = iptr->isn_arg.string;
1468-
if (do_cmdline(get_split_sourceline(0, &cookie, 0, 0),
1469+
line = get_split_sourceline(0, &cookie, 0, 0);
1470+
if (do_cmdline(line,
14691471
get_split_sourceline, &cookie,
14701472
DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED)
14711473
== FAIL
14721474
|| did_emsg)
1475+
{
1476+
vim_free(line);
14731477
goto on_error;
1478+
}
1479+
vim_free(line);
14741480
}
14751481
break;
14761482

0 commit comments

Comments
 (0)