diff --git a/src/nvim/eval.c b/src/nvim/eval.c index bdda1f3166..04ae4bc422 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -4458,9 +4458,7 @@ static int eval_dict(char **arg, typval_T *rettv, evalarg_T *const evalarg, bool *arg = skipwhite(*arg + 1); if (eval1(arg, &tv, evalarg) == FAIL) { // Recursive! - if (evaluate) { - tv_clear(&tvkey); - } + tv_clear(&tvkey); goto failret; } if (evaluate) { diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index 4aa9baff84..58c8a1705c 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -567,6 +567,8 @@ func Test_dict_literal_keys() " why *{} cannot be used for a literal dictionary let blue = 'blue' call assert_equal('6', trim(execute('echo 2 *{blue: 3}.blue'))) + + call assert_fails('eval 1 || #{a:', 'E15:') " used to leak endfunc " Nasty: deepcopy() dict that refers to itself (fails when noref used)