diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-09-26 12:03:20 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-09-30 21:00:17 -0400 |
commit | 4edf7b9ff22ca702876a7d0b5534fa2fc16b1897 (patch) | |
tree | c92b7fdf153bf781a65c9edbd8eeab55ef63091b /src/nvim/getchar.c | |
parent | 7cb38d5ac41efc1dce80a2e40c9c55f8a3802d61 (diff) | |
download | rneovim-4edf7b9ff22ca702876a7d0b5534fa2fc16b1897.tar.gz rneovim-4edf7b9ff22ca702876a7d0b5534fa2fc16b1897.tar.bz2 rneovim-4edf7b9ff22ca702876a7d0b5534fa2fc16b1897.zip |
vim-patch:8.1.1591: on error garbage collection may free memory in use
Problem: On error garbage collection may free memory in use.
Solution: Reset may_garbage_collect when evaluating expression mapping.
Add tests. (Ozaki Kiichi, closes vim/vim#4579)
https://github.com/vim/vim/commit/7d491c425334d9477637372a4ebec64c228c8430
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r-- | src/nvim/getchar.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index c35398cd8d..ecb3931b82 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -2044,14 +2044,19 @@ static int vgetorpeek(bool advance) */ if (mp->m_expr) { int save_vgetc_busy = vgetc_busy; + const bool save_may_garbage_collect = may_garbage_collect; vgetc_busy = 0; + may_garbage_collect = false; + save_m_keys = vim_strsave(mp->m_keys); save_m_str = vim_strsave(mp->m_str); s = eval_map_expr(save_m_str, NUL); vgetc_busy = save_vgetc_busy; - } else + may_garbage_collect = save_may_garbage_collect; + } else { s = mp->m_str; + } /* * Insert the 'to' part in the typebuf.tb_buf. |