mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 15:28:17 +00:00
vim-patch:7.4.2139
Problem: :delfunction causes illegal memory access.
Solution: Correct logic when deciding to free a function.
0588d4f9d2
This commit is contained in:
@@ -20926,6 +20926,7 @@ void ex_function(exarg_T *eap)
|
||||
int varargs = false;
|
||||
int flags = 0;
|
||||
ufunc_T *fp;
|
||||
bool overwrite = false;
|
||||
int indent;
|
||||
int nesting;
|
||||
char_u *skip_until = NULL;
|
||||
@@ -21337,7 +21338,7 @@ void ex_function(exarg_T *eap)
|
||||
} else {
|
||||
// redefine existing function
|
||||
ga_clear_strings(&(fp->uf_args));
|
||||
ga_clear_strings(&(fp->uf_lines))
|
||||
ga_clear_strings(&(fp->uf_lines));
|
||||
xfree(name);
|
||||
name = NULL;
|
||||
}
|
||||
@@ -22156,7 +22157,7 @@ void ex_delfunction(exarg_T *eap)
|
||||
// Numbered functions and lambdas snould be kept if the refcount is
|
||||
// one or more.
|
||||
if (fp->uf_refcount > (isdigit(fp->uf_name[0])
|
||||
|| fp->uf_name[0] == '<') ? 0 : 1) {
|
||||
|| fp->uf_name[0] == '<' ? 0 : 1)) {
|
||||
// Function is still referenced somewhere. Don't free it but
|
||||
// do remove it from the hashtable.
|
||||
func_remove(fp);
|
||||
|
@@ -301,7 +301,7 @@ static int included_patches[] = {
|
||||
// 2142,
|
||||
// 2141,
|
||||
// 2140 NA
|
||||
// 2139,
|
||||
2139,
|
||||
// 2138 NA
|
||||
2137,
|
||||
2136,
|
||||
|
Reference in New Issue
Block a user