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)
|
if (fudi.fd_di == NULL)
|
||||||
{
|
{
|
||||||
vim_free(fp);
|
vim_free(fp);
|
||||||
|
fp = NULL;
|
||||||
goto erret;
|
goto erret;
|
||||||
}
|
}
|
||||||
if (dict_add(fudi.fd_dict, fudi.fd_di) == FAIL)
|
if (dict_add(fudi.fd_dict, fudi.fd_di) == FAIL)
|
||||||
{
|
{
|
||||||
vim_free(fudi.fd_di);
|
vim_free(fudi.fd_di);
|
||||||
vim_free(fp);
|
vim_free(fp);
|
||||||
|
fp = NULL;
|
||||||
goto erret;
|
goto erret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3169,6 +3171,7 @@ def_function(exarg_T *eap, char_u *name_arg)
|
|||||||
else if (hash_add(&func_hashtab, UF2HIKEY(fp)) == FAIL)
|
else if (hash_add(&func_hashtab, UF2HIKEY(fp)) == FAIL)
|
||||||
{
|
{
|
||||||
vim_free(fp);
|
vim_free(fp);
|
||||||
|
fp = NULL;
|
||||||
goto erret;
|
goto erret;
|
||||||
}
|
}
|
||||||
fp->uf_refcount = 1;
|
fp->uf_refcount = 1;
|
||||||
|
@@ -746,6 +746,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
825,
|
||||||
/**/
|
/**/
|
||||||
824,
|
824,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user