mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 8.2.3951: Vim9: memory leak when text after a nested function
Problem: Vim9: memory leak when text after a nested function. Solution: Free the function if text is found after "enddef".
This commit is contained in:
@@ -1493,9 +1493,20 @@ def Test_call_varargs_only()
|
|||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_using_var_as_arg()
|
def Test_using_var_as_arg()
|
||||||
writefile(['def Func(x: number)', 'var x = 234', 'enddef', 'defcompile'], 'Xdef')
|
var lines =<< trim END
|
||||||
assert_fails('so Xdef', 'E1006:', '', 1, 'Func')
|
def Func(x: number)
|
||||||
delete('Xdef')
|
var x = 234
|
||||||
|
enddef
|
||||||
|
END
|
||||||
|
CheckDefFailure(lines, 'E1006:')
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
def Func(Ref: number)
|
||||||
|
def Ref()
|
||||||
|
enddef
|
||||||
|
enddef
|
||||||
|
END
|
||||||
|
CheckDefFailure(lines, 'E1073:')
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def DictArg(arg: dict<string>)
|
def DictArg(arg: dict<string>)
|
||||||
|
@@ -749,6 +749,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3951,
|
||||||
/**/
|
/**/
|
||||||
3950,
|
3950,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -889,6 +889,7 @@ compile_nested_function(exarg_T *eap, cctx_T *cctx, char_u **line_to_free)
|
|||||||
semsg(_(e_text_found_after_str_str),
|
semsg(_(e_text_found_after_str_str),
|
||||||
eap->cmdidx == CMD_def ? "enddef" : "endfunction", eap->nextcmd);
|
eap->cmdidx == CMD_def ? "enddef" : "endfunction", eap->nextcmd);
|
||||||
r = FAIL;
|
r = FAIL;
|
||||||
|
func_ptr_unref(ufunc);
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user