vim-patch:8.2.2764: memory leak when default function argument is allocated

Problem:    Memory leak when default function argument is allocated.
Solution:   Free the expression result.
b47bed2f7a
This commit is contained in:
Jan Edmund Lazo
2021-04-15 18:15:45 -04:00
parent 7d3f31c064
commit 97288e73c2
2 changed files with 22 additions and 5 deletions

View File

@@ -1071,10 +1071,10 @@ func Test_inputlist()
endfunc
func Test_balloon_show()
if has('balloon_eval')
" This won't do anything but must not crash either.
call balloon_show('hi!')
endif
CheckFeature balloon_eval
" This won't do anything but must not crash either.
call balloon_show('hi!')
endfunc
func Test_shellescape()
@@ -1448,4 +1448,12 @@ func Test_nr2char()
call assert_equal("\x80\xfc\b\xfd\x80\xfeX\x80\xfeX\x80\xfeX\x80\xfeX\x80\xfeX", eval('"\<M-' .. nr2char(0x40000000) .. '>"'))
endfunc
func HasDefault(msg = 'msg')
return a:msg
endfunc
func Test_default_arg_value()
call assert_equal('msg', HasDefault())
endfunc
" vim: shiftwidth=2 sts=2 expandtab