]> granicus.if.org Git - neomutt/commitdiff
fix: memory leak in parse_menu()
authorRichard Russon <rich@flatcap.org>
Thu, 22 Aug 2019 15:53:00 +0000 (16:53 +0100)
committerRichard Russon <rich@flatcap.org>
Fri, 23 Aug 2019 13:01:53 +0000 (14:01 +0100)
keymap.c

index b88b9b62a081e3c464a95ce408063c0ebeec72c9..361143c42077501887ddfcab4b301f3fedc37dd3 100644 (file)
--- a/keymap.c
+++ b/keymap.c
@@ -1328,16 +1328,16 @@ enum CommandResult mutt_parse_bind(struct Buffer *buf, struct Buffer *s,
 static void *parse_menu(int *menu, char *s, struct Buffer *err)
 {
   char *menu_names_dup = mutt_str_strdup(s);
+  char *marker = menu_names_dup;
   char *menu_name = NULL;
 
-  while ((menu_name = strsep(&menu_names_dup, ",")))
+  while ((menu_name = strsep(&marker, ",")))
   {
     int value = mutt_map_get_value(menu_name, Menus);
     if (value == -1)
     {
       mutt_buffer_printf(err, _("%s: no such menu"), menu_name);
-      FREE(&menu_names_dup);
-      return NULL;
+      break;
     }
     else
       menu[value] = true;