diff --git a/src/nvim/eval.c b/src/nvim/eval.c index cee565b2e4..d1359dccb0 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -5233,9 +5233,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 678734dafb..8f99bc8643 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -560,6 +560,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)