* kern/disk.c (grub_disk_read): Check return value of
grub_realloc().
+2007-05-18 Jeroen Dekkers <jeroen@dekkers.cx>
+
+ * kern/disk.c (grub_disk_read): Check return value of
+ grub_realloc().
+
2007-05-18 Jeroen Dekkers <jeroen@dekkers.cx>
* util/getroot.c (grub_util_get_grub_dev): Support partitionable
{
/* Uggh... Failed. Instead, just read necessary data. */
unsigned num;
+ char *p;
grub_errno = GRUB_ERR_NONE;
num = ((size + GRUB_DISK_SECTOR_SIZE - 1)
>> GRUB_DISK_SECTOR_BITS);
- tmp_buf = grub_realloc (tmp_buf, num << GRUB_DISK_SECTOR_BITS);
+ p = grub_realloc (tmp_buf, num << GRUB_DISK_SECTOR_BITS);
+ if (!p)
+ goto finish;
+
+ tmp_buf = p;
+
if ((disk->dev->read) (disk, sector, num, tmp_buf))
{
grub_error_push ();