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.
diff --git a/src/vim9compile.c b/src/vim9compile.c
index f02ea60..bfa54fe 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -4392,7 +4392,10 @@
// eval the next expression
*arg = skipwhite(p + 2);
if (may_get_next_line_error(p + 2, arg, cctx) == FAIL)
+ {
+ ga_clear(&end_ga);
return FAIL;
+ }
if ((opchar == '|' ? compile_expr3(arg, cctx, ppconst)
: compile_expr4(arg, cctx, ppconst)) == FAIL)