comparison src/getchar.c @ 17184:a5c3d374e1d3 v8.1.1591

patch 8.1.1591: on error garbage collection may free memory in use commit https://github.com/vim/vim/commit/7d491c425334d9477637372a4ebec64c228c8430 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 25 06:28:02 2019 +0200 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 #4579)
author Bram Moolenaar <Bram@vim.org>
date Tue, 25 Jun 2019 06:30:09 +0200
parents 998603a243d7
children 6f1679e1082d
comparison
equal deleted inserted replaced
17183:694c578dedd2 17184:a5c3d374e1d3
2538 * expression. Also save and restore the command line 2538 * expression. Also save and restore the command line
2539 * for "normal :". 2539 * for "normal :".
2540 */ 2540 */
2541 if (mp->m_expr) 2541 if (mp->m_expr)
2542 { 2542 {
2543 int save_vgetc_busy = vgetc_busy; 2543 int save_vgetc_busy = vgetc_busy;
2544 int save_may_garbage_collect = may_garbage_collect;
2544 2545
2545 vgetc_busy = 0; 2546 vgetc_busy = 0;
2547 may_garbage_collect = FALSE;
2548
2546 save_m_keys = vim_strsave(mp->m_keys); 2549 save_m_keys = vim_strsave(mp->m_keys);
2547 save_m_str = vim_strsave(mp->m_str); 2550 save_m_str = vim_strsave(mp->m_str);
2548 s = eval_map_expr(save_m_str, NUL); 2551 s = eval_map_expr(save_m_str, NUL);
2552
2549 vgetc_busy = save_vgetc_busy; 2553 vgetc_busy = save_vgetc_busy;
2554 may_garbage_collect = save_may_garbage_collect;
2550 } 2555 }
2551 else 2556 else
2552 #endif 2557 #endif
2553 s = mp->m_str; 2558 s = mp->m_str;
2554 2559