comparison src/userfunc.c @ 16969:8c794a694d66 v8.1.1485

patch 8.1.1485: double free when garbage_collect() is used in autocommand commit https://github.com/vim/vim/commit/c07f67ad0e9c48a07d49f2d67eb63e183a22386a Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 6 19:03:17 2019 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Thu, 06 Jun 2019 19:15:06 +0200
parents a836d122231a
children d244a9be99db
comparison
equal deleted inserted replaced
16968:8a2324f4a8ba 16969:8c794a694d66
4028 * Set "copyID" in all local vars and arguments in the call stack. 4028 * Set "copyID" in all local vars and arguments in the call stack.
4029 */ 4029 */
4030 int 4030 int
4031 set_ref_in_call_stack(int copyID) 4031 set_ref_in_call_stack(int copyID)
4032 { 4032 {
4033 int abort = FALSE; 4033 int abort = FALSE;
4034 funccall_T *fc; 4034 funccall_T *fc;
4035 funccal_entry_T *entry;
4035 4036
4036 for (fc = current_funccal; fc != NULL; fc = fc->caller) 4037 for (fc = current_funccal; fc != NULL; fc = fc->caller)
4037 abort = abort || set_ref_in_funccal(fc, copyID); 4038 abort = abort || set_ref_in_funccal(fc, copyID);
4039
4040 // Also go through the funccal_stack.
4041 for (entry = funccal_stack; entry != NULL; entry = entry->next)
4042 for (fc = entry->top_funccal; fc != NULL; fc = fc->caller)
4043 abort = abort || set_ref_in_funccal(fc, copyID);
4044
4038 return abort; 4045 return abort;
4039 } 4046 }
4040 4047
4041 /* 4048 /*
4042 * Set "copyID" in all functions available by name. 4049 * Set "copyID" in all functions available by name.