Problem: memory leak when not evaluating (just parsing) invalid literal
dict.
Solution: Always clear the key's typval (Sean Dewar)
Though "check_typval_is_value(&tv) == FAIL && !evaluate" is maybe never
true, also always clear tvs if check_typval_is_value fails; at worst
this would be a no-op as their initial types are VAR_UNKNOWN.
closes: #19178
Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
*arg = skipwhite_and_linebreak(*arg + 1, evalarg);
if (eval1(arg, &tv, evalarg) == FAIL) // recursive!
{
- if (evaluate)
- clear_tv(&tvkey);
+ clear_tv(&tvkey);
goto failret;
}
if (check_typval_is_value(&tv) == FAIL)
{
- if (evaluate)
- {
- clear_tv(&tvkey);
- clear_tv(&tv);
- }
+ clear_tv(&tvkey);
+ clear_tv(&tv);
goto failret;
}
if (evaluate)
" 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)
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2086,
/**/
2085,
/**/