diff options
| author | Michael Ennen <mike.ennen@gmail.com> | 2016-12-16 14:56:09 -0700 | 
|---|---|---|
| committer | Michael Ennen <mike.ennen@gmail.com> | 2017-02-14 17:38:18 -0700 | 
| commit | e71e9020eb31cfd606469e5d5ab97500232c65d6 (patch) | |
| tree | b01f810be4991d5463480afddb5a496f6905e999 /src/nvim/eval.c | |
| parent | 53fad45115d3ee438dfb537d99ccf3b021ebc6b7 (diff) | |
| download | rneovim-e71e9020eb31cfd606469e5d5ab97500232c65d6.tar.gz rneovim-e71e9020eb31cfd606469e5d5ab97500232c65d6.tar.bz2 rneovim-e71e9020eb31cfd606469e5d5ab97500232c65d6.zip | |
vim-patch:7.4.2139
Problem:    :delfunction causes illegal memory access.
Solution:   Correct logic when deciding to free a function.
https://github.com/vim/vim/commit/0588d4f9d2741f35a271400a37fddbdd72d84219
Diffstat (limited to 'src/nvim/eval.c')
| -rw-r--r-- | src/nvim/eval.c | 7 | 
1 files changed, 4 insertions, 3 deletions
| diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 2e0ac6034d..70c47b09a6 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -219,7 +219,7 @@ static int echo_attr = 0;   /* attributes used for ":echo" */  #define FC_REMOVED  32          // function redefined while uf_refcount > 0  // The names of packages that once were loaded are remembered. -static garray_T ga_loaded = {0, 0, sizeof(char_u *), 4, NULL}; +static garray_T ga_loaded = { 0, 0, sizeof(char_u *), 4, NULL };  // List heads for garbage collection. Although there can be a reference loop  // from partial to dict to partial, we don't need to keep track of the partial, @@ -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); | 
