mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
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.
This commit is contained in:
@@ -3140,12 +3140,14 @@ def_function(exarg_T *eap, char_u *name_arg)
|
||||
if (fudi.fd_di == NULL)
|
||||
{
|
||||
vim_free(fp);
|
||||
fp = NULL;
|
||||
goto erret;
|
||||
}
|
||||
if (dict_add(fudi.fd_dict, fudi.fd_di) == FAIL)
|
||||
{
|
||||
vim_free(fudi.fd_di);
|
||||
vim_free(fp);
|
||||
fp = NULL;
|
||||
goto erret;
|
||||
}
|
||||
}
|
||||
@@ -3169,6 +3171,7 @@ def_function(exarg_T *eap, char_u *name_arg)
|
||||
else if (hash_add(&func_hashtab, UF2HIKEY(fp)) == FAIL)
|
||||
{
|
||||
vim_free(fp);
|
||||
fp = NULL;
|
||||
goto erret;
|
||||
}
|
||||
fp->uf_refcount = 1;
|
||||
|
@@ -746,6 +746,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
825,
|
||||
/**/
|
||||
824,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user