diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-12-06 16:03:55 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-12-06 16:03:55 +0100 |
commit | 8bb0f5472c740458708fd3edabbb8d5193a96241 (patch) | |
tree | b21ab779e1502e16c2275d0fe9ec120c561a3279 /src | |
parent | 67322bf74a106b6476b093e75da87d61e2181b76 (diff) | |
download | vim-git-8bb0f5472c740458708fd3edabbb8d5193a96241.tar.gz |
patch 8.2.2101: Vim9: memory leak when literal dict has an errorv8.2.2101
Problem: Vim9: memory leak when literal dict has an error and when an
expression is not complete.
Solution: Clear the typval and the growarray.
Diffstat (limited to 'src')
-rw-r--r-- | src/dict.c | 1 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9compile.c | 3 |
3 files changed, 6 insertions, 0 deletions
diff --git a/src/dict.c b/src/dict.c index 311b0038d..5581a5571 100644 --- a/src/dict.c +++ b/src/dict.c @@ -929,6 +929,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal) if (**arg != ']') { emsg(_(e_missing_matching_bracket_after_dict_key)); + clear_tv(&tvkey); return FAIL; } ++*arg; diff --git a/src/version.c b/src/version.c index 2754d2f72..56cea2657 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2101, +/**/ 2100, /**/ 2099, diff --git a/src/vim9compile.c b/src/vim9compile.c index f02ea60cc..bfa54fea7 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -4392,7 +4392,10 @@ compile_and_or( // 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) |