mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00: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:
@@ -2867,6 +2867,7 @@ void ex_function(exarg_T *eap)
|
|||||||
if (tv_dict_add(fudi.fd_dict, fudi.fd_di) == FAIL) {
|
if (tv_dict_add(fudi.fd_dict, fudi.fd_di) == FAIL) {
|
||||||
xfree(fudi.fd_di);
|
xfree(fudi.fd_di);
|
||||||
xfree(fp);
|
xfree(fp);
|
||||||
|
fp = NULL;
|
||||||
goto erret;
|
goto erret;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -2887,6 +2888,7 @@ void ex_function(exarg_T *eap)
|
|||||||
hi->hi_key = UF2HIKEY(fp);
|
hi->hi_key = UF2HIKEY(fp);
|
||||||
} else if (hash_add(&func_hashtab, UF2HIKEY(fp)) == FAIL) {
|
} else if (hash_add(&func_hashtab, UF2HIKEY(fp)) == FAIL) {
|
||||||
xfree(fp);
|
xfree(fp);
|
||||||
|
fp = NULL;
|
||||||
goto erret;
|
goto erret;
|
||||||
}
|
}
|
||||||
fp->uf_refcount = 1;
|
fp->uf_refcount = 1;
|
||||||
|
Reference in New Issue
Block a user