mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 15:21:47 +00:00
vim-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.
c07f67ad0e
This commit is contained in:
@@ -3356,9 +3356,18 @@ bool set_ref_in_call_stack(int copyID)
|
||||
bool abort = false;
|
||||
|
||||
for (funccall_T *fc = current_funccal; fc != NULL; fc = fc->caller) {
|
||||
abort = abort || set_ref_in_ht(&fc->l_vars.dv_hashtab, copyID, NULL);
|
||||
abort = abort || set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID, NULL);
|
||||
abort = abort || set_ref_in_funccal(fc, copyID);
|
||||
}
|
||||
|
||||
// Also go through the funccal_stack.
|
||||
for (funccal_entry_T *entry = funccal_stack; entry != NULL;
|
||||
entry = entry->next) {
|
||||
for (funccall_T *fc = entry->top_funccal; !abort && fc != NULL;
|
||||
fc = fc->caller) {
|
||||
abort = abort || set_ref_in_funccal(fc, copyID);
|
||||
}
|
||||
}
|
||||
|
||||
return abort;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user