mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.0825: def_function() may return pointer that was freed
Problem: def_function() may return pointer that was freed.
Solution: Set "fp" to NULL after freeing it.
a14e697547
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
parent
af069c5c05
commit
0309d3fbf0
@ -2867,6 +2867,7 @@ void ex_function(exarg_T *eap)
|
||||
if (tv_dict_add(fudi.fd_dict, fudi.fd_di) == FAIL) {
|
||||
xfree(fudi.fd_di);
|
||||
xfree(fp);
|
||||
fp = NULL;
|
||||
goto erret;
|
||||
}
|
||||
} else {
|
||||
@ -2887,6 +2888,7 @@ void ex_function(exarg_T *eap)
|
||||
hi->hi_key = UF2HIKEY(fp);
|
||||
} else if (hash_add(&func_hashtab, UF2HIKEY(fp)) == FAIL) {
|
||||
xfree(fp);
|
||||
fp = NULL;
|
||||
goto erret;
|
||||
}
|
||||
fp->uf_refcount = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user