mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.1.1485: double free when garbage_collect() is used in autocommand
Problem: Double free when garbage_collect() is used in autocommand. Solution: Have garbage collection also set the copyID in funccal_stack.
This commit is contained in:
parent
75ee544f99
commit
c07f67ad0e
@ -430,12 +430,11 @@ eval_clear(void)
|
|||||||
vim_free(SCRIPT_SV(i));
|
vim_free(SCRIPT_SV(i));
|
||||||
ga_clear(&ga_scripts);
|
ga_clear(&ga_scripts);
|
||||||
|
|
||||||
// functions need to be freed before gargabe collecting, otherwise local
|
|
||||||
// variables might be freed twice.
|
|
||||||
free_all_functions();
|
|
||||||
|
|
||||||
// unreferenced lists and dicts
|
// unreferenced lists and dicts
|
||||||
(void)garbage_collect(FALSE);
|
(void)garbage_collect(FALSE);
|
||||||
|
|
||||||
|
// functions not garbage collected
|
||||||
|
free_all_functions();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -4032,9 +4032,16 @@ set_ref_in_call_stack(int copyID)
|
|||||||
{
|
{
|
||||||
int abort = FALSE;
|
int abort = FALSE;
|
||||||
funccall_T *fc;
|
funccall_T *fc;
|
||||||
|
funccal_entry_T *entry;
|
||||||
|
|
||||||
for (fc = current_funccal; fc != NULL; fc = fc->caller)
|
for (fc = current_funccal; fc != NULL; fc = fc->caller)
|
||||||
abort = abort || set_ref_in_funccal(fc, copyID);
|
abort = abort || set_ref_in_funccal(fc, copyID);
|
||||||
|
|
||||||
|
// Also go through the funccal_stack.
|
||||||
|
for (entry = funccal_stack; entry != NULL; entry = entry->next)
|
||||||
|
for (fc = entry->top_funccal; fc != NULL; fc = fc->caller)
|
||||||
|
abort = abort || set_ref_in_funccal(fc, copyID);
|
||||||
|
|
||||||
return abort;
|
return abort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -767,6 +767,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 */
|
||||||
|
/**/
|
||||||
|
1485,
|
||||||
/**/
|
/**/
|
||||||
1484,
|
1484,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user