2009-04-27 Pavel Roskin <proski@gnu.org>
* disk/fs_uuid.c (grub_fs_uuid_open): Allocate memory to copy parent's partition, don't copy it by reference, as it gets freed on close.
This commit is contained in:
parent
75a807cf00
commit
136d9f8283
2 changed files with 17 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2009-04-28 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* disk/fs_uuid.c (grub_fs_uuid_open): Allocate memory to copy
|
||||||
|
parent's partition, don't copy it by reference, as it gets freed
|
||||||
|
on close.
|
||||||
|
|
||||||
2009-04-27 Vladimir Serbinenko <phcoder@gmail.com>
|
2009-04-27 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
Preboot hooks support
|
Preboot hooks support
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
|
|
||||||
#include <grub/fs.h>
|
#include <grub/fs.h>
|
||||||
|
#include <grub/partition.h>
|
||||||
|
|
||||||
static grub_device_t
|
static grub_device_t
|
||||||
search_fs_uuid (const char *key, unsigned long *count)
|
search_fs_uuid (const char *key, unsigned long *count)
|
||||||
|
@ -88,7 +89,16 @@ grub_fs_uuid_open (const char *name, grub_disk_t disk)
|
||||||
|
|
||||||
disk->total_sectors = dev->disk->total_sectors;
|
disk->total_sectors = dev->disk->total_sectors;
|
||||||
disk->has_partitions = 0;
|
disk->has_partitions = 0;
|
||||||
disk->partition = dev->disk->partition;
|
if (dev->disk->partition)
|
||||||
|
{
|
||||||
|
disk->partition = grub_malloc (sizeof (*disk->partition));
|
||||||
|
if (disk->partition)
|
||||||
|
grub_memcpy (disk->partition, dev->disk->partition,
|
||||||
|
sizeof (*disk->partition));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
disk->partition = NULL;
|
||||||
|
|
||||||
disk->data = dev->disk;
|
disk->data = dev->disk;
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue