1
0
forked from aniani/vim

patch 8.2.0399: various memory leaks

Problem:    Various memory leaks.
Solution:   Avoid the leaks. (Ozaki Kiichi, closes #5803)
This commit is contained in:
Bram Moolenaar
2020-03-18 15:23:16 +01:00
parent a21df1db3c
commit 292b90d4fa
7 changed files with 29 additions and 4 deletions

View File

@@ -2882,10 +2882,16 @@ menuitem_getinfo(vimmenu_T *menu, int modes, dict_T *dict)
if (bit < MENU_MODES) // just in case, avoid Coverity warning
{
if (menu->strings[bit] != NULL)
{
char_u *tofree = NULL;
status = dict_add_string(dict, "rhs",
*menu->strings[bit] == NUL
? vim_strsave((char_u *)"<Nop>")
: str2special_save(menu->strings[bit], FALSE));
? (char_u *)"<Nop>"
: (tofree = str2special_save(
menu->strings[bit], FALSE)));
vim_free(tofree);
}
if (status == OK)
status = dict_add_bool(dict, "noremenu",
menu->noremap[bit] == REMAP_NONE);