Mercurial > vim
diff src/digraph.c @ 13121:3321582cae78 v8.0.1435
patch 8.0.1435: memory leak in test_arabic
commit https://github.com/vim/vim/commit/501383236d203bacad758e82e47a07b877a3b63b
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 28 17:05:16 2018 +0100
patch 8.0.1435: memory leak in test_arabic
Problem: Memory leak in test_arabic.
Solution: Free the from and to parts. (Christian Brabandt, closes https://github.com/vim/vim/issues/2569)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 28 Jan 2018 17:15:05 +0100 |
parents | 351cf7c67bbe |
children | 81c348d40312 |
line wrap: on
line diff
--- a/src/digraph.c +++ b/src/digraph.c @@ -2452,9 +2452,8 @@ keymap_unload(void) { vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s", kp[i].from); (void)do_map(1, buf, LANGMAP, FALSE); - vim_free(kp[i].from); - vim_free(kp[i].to); } + keymap_clear(&curbuf->b_kmap_ga); p_cpo = save_cpo; @@ -2463,4 +2462,16 @@ keymap_unload(void) status_redraw_curbuf(); } + void +keymap_clear(garray_T *kmap) +{ + int i; + kmap_T *kp = (kmap_T *)kmap->ga_data; + + for (i = 0; i < kmap->ga_len; ++i) + { + vim_free(kp[i].from); + vim_free(kp[i].to); + } +} #endif /* FEAT_KEYMAP */