diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-01-28 17:05:16 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-01-28 17:05:16 +0100 |
commit | 501383236d203bacad758e82e47a07b877a3b63b (patch) | |
tree | c96e0fee728c53368526301c823b5845c2412e99 /src/digraph.c | |
parent | d7823d5b7c32f73ca720373ea9c16b1b47f086df (diff) | |
download | vim-git-501383236d203bacad758e82e47a07b877a3b63b.tar.gz |
patch 8.0.1435: memory leak in test_arabicv8.0.1435
Problem: Memory leak in test_arabic.
Solution: Free the from and to parts. (Christian Brabandt, closes #2569)
Diffstat (limited to 'src/digraph.c')
-rw-r--r-- | src/digraph.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/digraph.c b/src/digraph.c index 6b5a5aac2..2c7ba9f0c 100644 --- 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 */ |