Mercurial > vim
comparison src/eval.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 | 586d625e21b4 |
children | 301f6deea057 |
comparison
equal
deleted
inserted
replaced
16968:8a2324f4a8ba | 16969:8c794a694d66 |
---|---|
428 vars_clear(&SCRIPT_VARS(i)); | 428 vars_clear(&SCRIPT_VARS(i)); |
429 for (i = 1; i <= ga_scripts.ga_len; ++i) | 429 for (i = 1; i <= ga_scripts.ga_len; ++i) |
430 vim_free(SCRIPT_SV(i)); | 430 vim_free(SCRIPT_SV(i)); |
431 ga_clear(&ga_scripts); | 431 ga_clear(&ga_scripts); |
432 | 432 |
433 // functions need to be freed before gargabe collecting, otherwise local | |
434 // variables might be freed twice. | |
435 free_all_functions(); | |
436 | |
437 // unreferenced lists and dicts | 433 // unreferenced lists and dicts |
438 (void)garbage_collect(FALSE); | 434 (void)garbage_collect(FALSE); |
435 | |
436 // functions not garbage collected | |
437 free_all_functions(); | |
439 } | 438 } |
440 #endif | 439 #endif |
441 | 440 |
442 | 441 |
443 /* | 442 /* |