Merge mainline into nestpart

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-02-06 21:03:32 +01:00
commit 35b86ff407
4 changed files with 54 additions and 28 deletions

View file

@ -1,3 +1,16 @@
2010-02-06 Vladimir Serbinenko <phcoder@gmail.com>
* partmap/sun.c (sun_partition_map_iterate): Restructure flow to fix
buggy hook call and memory leak.
2010-02-06 Vladimir Serbinenko <phcoder@gmail.com>
* commands/ls.c (grub_ls_list_files): Free pathname on exit.
2010-02-06 Vladimir Serbinenko <phcoder@gmail.com>
* fs/fat.c (grub_fat_iterate_dir): Free unibuf at exit.
2010-02-06 Vladimir Serbinenko <phcoder@gmail.com>
* loader/i386/pc/xnu.c (grub_xnu_set_video): Add const qualifier to

View file

@ -87,14 +87,13 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
int print_files_long (const char *filename,
const struct grub_dirhook_info *info)
{
char *pathname;
if ((! all) && (filename[0] == '.'))
return 0;
if (! info->dir)
{
grub_file_t file;
char *pathname;
if (dirname[grub_strlen (dirname) - 1] == '/')
pathname = grub_xasprintf ("%s%s", dirname, filename);
@ -110,6 +109,7 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
if (! file)
{
grub_errno = 0;
grub_free (pathname);
return 0;
}
@ -144,6 +144,7 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
}
grub_file_close (file);
grub_free (pathname);
}
else
grub_printf ("%-12s", "DIR");

View file

@ -592,6 +592,7 @@ grub_fat_iterate_dir (grub_disk_t disk, struct grub_fat_data *data,
}
grub_free (filename);
grub_free (unibuf);
return grub_errno;
}

View file

@ -90,20 +90,32 @@ sun_partition_map_iterate (grub_disk_t disk,
grub_partition_t p;
struct grub_sun_block block;
int partnum;
grub_err_t err;
p = (grub_partition_t) grub_zalloc (sizeof (struct grub_partition));
if (! p)
return grub_errno;
p->partmap = &grub_sun_partition_map;
if (grub_disk_read (disk, 0, 0, sizeof (struct grub_sun_block),
&block) == GRUB_ERR_NONE)
err = grub_disk_read (disk, 0, 0, sizeof (struct grub_sun_block),
&block);
if (err)
{
grub_free (p);
return err;
}
if (GRUB_PARTMAP_SUN_MAGIC != grub_be_to_cpu16 (block.magic))
grub_error (GRUB_ERR_BAD_PART_TABLE, "not a sun partition table");
{
grub_free (p);
return grub_error (GRUB_ERR_BAD_PART_TABLE, "not a sun partition table");
}
if (! grub_sun_is_valid (&block))
grub_error (GRUB_ERR_BAD_PART_TABLE, "invalid checksum");
{
grub_free (p);
return grub_error (GRUB_ERR_BAD_PART_TABLE, "invalid checksum");
}
/* Maybe another error value would be better, because partition
table _is_ recognized but invalid. */
@ -127,7 +139,6 @@ sun_partition_map_iterate (grub_disk_t disk,
partnum = GRUB_PARTMAP_SUN_MAX_PARTS;
}
}
}
grub_free (p);