mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 15:28:17 +00:00
vim-patch:8.1.1938: may crash when out of memory
Problem: May crash when out of memory.
Solution: Initialize v_type to VAR_UNKNOWN. (Dominique Pelle, closes vim/vim#4871)
c507a2d164
This commit is contained in:
@@ -6437,6 +6437,10 @@ call_func(
|
||||
typval_T argv[MAX_FUNC_ARGS + 1]; // used when "partial" is not NULL
|
||||
int argv_clear = 0;
|
||||
|
||||
// Initialize rettv so that it is safe for caller to invoke clear_tv(rettv)
|
||||
// even when call_func() returns FAIL.
|
||||
rettv->v_type = VAR_UNKNOWN;
|
||||
|
||||
// Make a copy of the name, if it comes from a funcref variable it could
|
||||
// be changed or deleted in the called function.
|
||||
name = vim_strnsave(funcname, len);
|
||||
@@ -6465,13 +6469,7 @@ call_func(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Execute the function if executing and no errors were detected.
|
||||
if (!evaluate) {
|
||||
// Not evaluating, which means the return value is unknown. This
|
||||
// matters for giving error messages.
|
||||
rettv->v_type = VAR_UNKNOWN;
|
||||
} else if (error == ERROR_NONE) {
|
||||
if (error == ERROR_NONE && evaluate) {
|
||||
char_u *rfname = fname;
|
||||
|
||||
/* Ignore "g:" before a function name. */
|
||||
|
Reference in New Issue
Block a user