diff --git a/ChangeLog b/ChangeLog index c5b6d9d9f..736f007ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2012-03-04 Andreas Vogel + + * grub-core/normal/main.c (grub_normal_free_menu): Fix memory leak. + 2012-03-04 Hideki EIRAKU * grub-core/normal/menu_entry.c (kill_line): Fix a crash and off-by-one diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c index be5d6b5bf..b58f0e3fc 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c @@ -133,7 +133,25 @@ grub_normal_free_menu (grub_menu_t menu) while (entry) { grub_menu_entry_t next_entry = entry->next; + grub_size_t i; + if (entry->classes) + { + struct grub_menu_entry_class *class; + for (class = entry->classes; class; class = class->next) + grub_free (class->name); + grub_free (entry->classes); + } + + if (entry->args) + { + for (i = 0; entry->args[i]; i++) + grub_free (entry->args[i]); + grub_free (entry->args); + } + + grub_free ((void *) entry->id); + grub_free ((void *) entry->users); grub_free ((void *) entry->title); grub_free ((void *) entry->sourcecode); entry = next_entry;