0
0
mirror of https://github.com/vim/vim.git synced 2025-09-02 21:13:50 -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

@ -2212,6 +2212,7 @@ free_buf_options(
clear_string_option(&buf->b_p_isk);
#ifdef FEAT_KEYMAP
clear_string_option(&buf->b_p_keymap);
keymap_clear(&buf->b_kmap_ga);
ga_clear(&buf->b_kmap_ga);
#endif
#ifdef FEAT_COMMENTS

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

View File

@ -6,4 +6,5 @@ void putdigraph(char_u *str);
void listdigraphs(void);
char_u *keymap_init(void);
void ex_loadkeymap(exarg_T *eap);
void keymap_clear(garray_T *kmap);
/* vim: set ft=c : */

View File

@ -771,6 +771,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1435,
/**/
1434,
/**/