Skip to content

Commit

Permalink
patch 8.2.2953: Vim9: leaking memory when using heredoc script
Browse files Browse the repository at this point in the history
Problem:    Vim9: leaking memory when using heredoc script.
Solution:   Free the first line.
  • Loading branch information
brammool committed Jun 6, 2021
1 parent 9928555 commit 518df27
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2953,
/**/
2952,
/**/
Expand Down
8 changes: 7 additions & 1 deletion src/vim9execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -1460,17 +1460,23 @@ exec_instructions(ectx_T *ectx)
case ISN_EXEC_SPLIT:
{
source_cookie_T cookie;
char_u *line;

SOURCING_LNUM = iptr->isn_lnum;
CLEAR_FIELD(cookie);
cookie.sourcing_lnum = iptr->isn_lnum - 1;
cookie.nextline = iptr->isn_arg.string;
if (do_cmdline(get_split_sourceline(0, &cookie, 0, 0),
line = get_split_sourceline(0, &cookie, 0, 0);
if (do_cmdline(line,
get_split_sourceline, &cookie,
DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED)
== FAIL
|| did_emsg)
{
vim_free(line);
goto on_error;
}
vim_free(line);
}
break;

Expand Down

0 comments on commit 518df27

Please sign in to comment.