diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-06-06 19:03:17 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-06-06 19:03:17 +0200 |
commit | c07f67ad0e9c48a07d49f2d67eb63e183a22386a (patch) | |
tree | a82a0eee25fe9c4f4c61cc749c85e2b771cbeb62 /src/userfunc.c | |
parent | 75ee544f99ca66be8105570c6309d95435ad30d1 (diff) | |
download | vim-git-c07f67ad0e9c48a07d49f2d67eb63e183a22386a.tar.gz |
patch 8.1.1485: double free when garbage_collect() is used in autocommandv8.1.1485
Problem: Double free when garbage_collect() is used in autocommand.
Solution: Have garbage collection also set the copyID in funccal_stack.
Diffstat (limited to 'src/userfunc.c')
-rw-r--r-- | src/userfunc.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/userfunc.c b/src/userfunc.c index 7abde07e3..3a0219af4 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -4030,11 +4030,18 @@ set_ref_in_funccal(funccall_T *fc, int copyID) int set_ref_in_call_stack(int copyID) { - int abort = FALSE; - funccall_T *fc; + int abort = FALSE; + funccall_T *fc; + funccal_entry_T *entry; for (fc = current_funccal; fc != NULL; fc = fc->caller) 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; } |