diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-03-18 15:23:16 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-03-18 15:23:16 +0100 |
commit | 292b90d4fa11022661f449dd3efb73d5ac737313 (patch) | |
tree | 843721ec1450241506c3ac1995bc2c32437caaf8 /src/menu.c | |
parent | a21df1db3ca619afdcb47931af042508a6bbc8e5 (diff) | |
download | vim-git-292b90d4fa11022661f449dd3efb73d5ac737313.tar.gz |
patch 8.2.0399: various memory leaksv8.2.0399
Problem: Various memory leaks.
Solution: Avoid the leaks. (Ozaki Kiichi, closes #5803)
Diffstat (limited to 'src/menu.c')
-rw-r--r-- | src/menu.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/menu.c b/src/menu.c index 3a9d2e41f..0c8887945 100644 --- a/src/menu.c +++ b/src/menu.c @@ -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); |