diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-09-21 20:35:55 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-09-21 20:35:55 +0200 |
commit | 078269bdce7e75d5693c7313d92a229786bb95ee (patch) | |
tree | 148a862c19fc9ae3d5d90f8c853ccaa090220705 /src/vim9compile.c | |
parent | 10e4f12bf4cd08328618bbf4e57a15435296e586 (diff) | |
download | vim-git-078269bdce7e75d5693c7313d92a229786bb95ee.tar.gz |
patch 8.2.1720: Vim9: memory leak with heredoc that isn't executedv8.2.1720
Problem: Vim9: memory leak with heredoc that isn't executed. (Dominique
Pellé)
Solution: Don't clear the list items. (closes #6991)
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r-- | src/vim9compile.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c index 1edf48ce6..52651f36a 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -4622,15 +4622,18 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx) eap->cookie = cctx; l = heredoc_get(eap, op + 3, FALSE); - // Push each line and the create the list. - FOR_ALL_LIST_ITEMS(l, li) + if (cctx->ctx_skip != SKIP_YES) { - generate_PUSHS(cctx, li->li_tv.vval.v_string); - li->li_tv.vval.v_string = NULL; + // Push each line and the create the list. + FOR_ALL_LIST_ITEMS(l, li) + { + generate_PUSHS(cctx, li->li_tv.vval.v_string); + li->li_tv.vval.v_string = NULL; + } + generate_NEWLIST(cctx, l->lv_len); + type = &t_list_string; + member_type = &t_list_string; } - generate_NEWLIST(cctx, l->lv_len); - type = &t_list_string; - member_type = &t_list_string; list_free(l); p += STRLEN(p); end = p; |