From 0f1ee647460bece847ea56353816f6bd4ce7e293 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Mon, 19 May 2008 21:34:55 +0200 Subject: [PATCH] Fix bug in :macmenu Menu item not found lead to bad memory access. --- src/menu.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/menu.c b/src/menu.c index 7d04b0c85c..eca37b5589 100644 --- a/src/menu.c +++ b/src/menu.c @@ -2834,11 +2834,6 @@ ex_macmenu(eap) vim_free(key); vim_free(arg); -theend: -#ifdef FEAT_MULTI_LANG - vim_free(tofree); -#endif - /* * Store all the keys that were set in the menu item. */ @@ -2851,13 +2846,21 @@ theend: menu->mac_key = mac_key; menu->mac_mods = mac_mods; } - if (set_alt != -1) + if (set_alt) menu->mac_alternate = mac_alternate; } else { vim_free(action); } + +theend: +#ifdef FEAT_MULTI_LANG + vim_free(tofree); +#else + ; +#endif + } #endif /* FEAT_GUI_MACVIM */