* grub-core/normal/main.c (grub_normal_free_menu): Fix memory leak.

This commit is contained in:
Andreas Vogel 2012-03-05 00:41:37 +01:00 committed by Vladimir 'phcoder' Serbinenko
parent cb05528616
commit 5ad1be828f
2 changed files with 22 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2012-03-04 Andreas Vogel <Andreas.Vogel@anvo-it.de>
* grub-core/normal/main.c (grub_normal_free_menu): Fix memory leak.
2012-03-04 Hideki EIRAKU <hdk1983@gmail.com>
* grub-core/normal/menu_entry.c (kill_line): Fix a crash and off-by-one

View file

@ -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;