Skip to content

Commit 8bb0f54

Browse files
committed
patch 8.2.2101: Vim9: memory leak when literal dict has an error
Problem: Vim9: memory leak when literal dict has an error and when an expression is not complete. Solution: Clear the typval and the growarray.
1 parent 67322bf commit 8bb0f54

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/dict.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
929929
if (**arg != ']')
930930
{
931931
emsg(_(e_missing_matching_bracket_after_dict_key));
932+
clear_tv(&tvkey);
932933
return FAIL;
933934
}
934935
++*arg;

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+
2101,
753755
/**/
754756
2100,
755757
/**/

src/vim9compile.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4392,7 +4392,10 @@ compile_and_or(
43924392
// eval the next expression
43934393
*arg = skipwhite(p + 2);
43944394
if (may_get_next_line_error(p + 2, arg, cctx) == FAIL)
4395+
{
4396+
ga_clear(&end_ga);
43954397
return FAIL;
4398+
}
43964399

43974400
if ((opchar == '|' ? compile_expr3(arg, cctx, ppconst)
43984401
: compile_expr4(arg, cctx, ppconst)) == FAIL)

0 commit comments

Comments
 (0)