0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

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 #2569)
This commit is contained in:
Bram Moolenaar
2018-01-28 17:05:16 +01:00
parent d7823d5b7c
commit 501383236d
4 changed files with 17 additions and 2 deletions

View File

@@ -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 */