Patch 8.2.3711
Problem: Vim9: memory leak when compiling :elseif fails.
Solution: Cleanup ppconst.
Files: src/vim9compile.c, src/testdir/test_vim9_cmd.vim
*** ../vim-8.2.3710/src/vim9compile.c 2021-12-01 09:26:29.923616562 +0000
--- src/vim9compile.c 2021-12-01 10:05:44.199626208 +0000
***************
*** 7888,7893 ****
--- 7888,7894 ----
cctx->ctx_skip = save_skip;
if (!ends_excmd2(arg, skipwhite(p)))
{
+ clear_ppconst(&ppconst);
semsg(_(e_trailing_arg), p);
return NULL;
}
***************
*** 7901,7907 ****
--- 7902,7911 ----
// The expression result is a constant.
v = tv_get_bool_chk(&ppconst.pp_tv[0], &error);
if (error)
+ {
+ clear_ppconst(&ppconst);
return NULL;
+ }
cctx->ctx_skip = v ? SKIP_NOT : SKIP_YES;
clear_ppconst(&ppconst);
scope->se_u.se_if.is_if_label = -1;
*** ../vim-8.2.3710/src/testdir/test_vim9_cmd.vim 2021-12-01 09:26:29.923616562 +0000
--- src/testdir/test_vim9_cmd.vim 2021-12-01 10:05:10.055501387 +0000
***************
*** 301,312 ****
CheckDefAndScriptFailure(lines, 'E1135:', 3)
lines =<< trim END
if g:cond
elseif [1]
endif
END
! CheckDefFailure(lines, 'E1012:', 2)
! CheckScriptFailure(['vim9script'] + lines, 'E745:', 3)
lines =<< trim END
g:cond = 'text'
--- 301,321 ----
CheckDefAndScriptFailure(lines, 'E1135:', 3)
lines =<< trim END
+ g:cond = 0
+ if g:cond
+ elseif 'text' garbage
+ endif
+ END
+ CheckDefAndScriptFailure(lines, 'E488:', 3)
+
+ lines =<< trim END
+ g:cond = 0
if g:cond
elseif [1]
endif
END
! CheckDefFailure(lines, 'E1012:', 3)
! CheckScriptFailure(['vim9script'] + lines, 'E745:', 4)
lines =<< trim END
g:cond = 'text'
*** ../vim-8.2.3710/src/version.c 2021-12-01 09:26:29.923616562 +0000
--- src/version.c 2021-12-01 09:59:43.314921603 +0000
***************
*** 755,756 ****
--- 755,758 ----
{ /* Add new patch number below this line */
+ /**/
+ 3711,
/**/
--
DENNIS: Oh, very nice. King, eh! I expect you've got a palace and fine
clothes and courtiers and plenty of food. And how d'you get that? By
exploiting the workers! By hanging on to outdated imperialist dogma
which perpetuates the social and economic differences in our society!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///