comparison src/menu.c @ 19685:d64f403289db v8.2.0399

patch 8.2.0399: various memory leaks Commit: https://github.com/vim/vim/commit/292b90d4fa11022661f449dd3efb73d5ac737313 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 18 15:23:16 2020 +0100 patch 8.2.0399: various memory leaks Problem: Various memory leaks. Solution: Avoid the leaks. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/5803)
author Bram Moolenaar <Bram@vim.org>
date Wed, 18 Mar 2020 15:30:04 +0100
parents 897cb43a5c72
children 3ff714d765ba
comparison
equal deleted inserted replaced
19684:0b7b0650000a 19685:d64f403289db
2880 for (bit = 0; bit < MENU_MODES && !((1 << bit) & modes); bit++) 2880 for (bit = 0; bit < MENU_MODES && !((1 << bit) & modes); bit++)
2881 ; 2881 ;
2882 if (bit < MENU_MODES) // just in case, avoid Coverity warning 2882 if (bit < MENU_MODES) // just in case, avoid Coverity warning
2883 { 2883 {
2884 if (menu->strings[bit] != NULL) 2884 if (menu->strings[bit] != NULL)
2885 {
2886 char_u *tofree = NULL;
2887
2885 status = dict_add_string(dict, "rhs", 2888 status = dict_add_string(dict, "rhs",
2886 *menu->strings[bit] == NUL 2889 *menu->strings[bit] == NUL
2887 ? vim_strsave((char_u *)"<Nop>") 2890 ? (char_u *)"<Nop>"
2888 : str2special_save(menu->strings[bit], FALSE)); 2891 : (tofree = str2special_save(
2892 menu->strings[bit], FALSE)));
2893 vim_free(tofree);
2894 }
2889 if (status == OK) 2895 if (status == OK)
2890 status = dict_add_bool(dict, "noremenu", 2896 status = dict_add_bool(dict, "noremenu",
2891 menu->noremap[bit] == REMAP_NONE); 2897 menu->noremap[bit] == REMAP_NONE);
2892 if (status == OK) 2898 if (status == OK)
2893 status = dict_add_bool(dict, "script", 2899 status = dict_add_bool(dict, "script",