]> git.proxmox.com Git - grub2.git/commitdiff
2009-04-27 Pavel Roskin <proski@gnu.org>
authorproski <proski@localhost>
Tue, 28 Apr 2009 13:14:20 +0000 (13:14 +0000)
committerproski <proski@localhost>
Tue, 28 Apr 2009 13:14:20 +0000 (13:14 +0000)
* 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.

ChangeLog
disk/fs_uuid.c

index ae73843648a51dd556b18eb38bde345ce3c7d0f8..e3d4b70052a772c1d9938907a71ce4fa5cb76cc1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        Preboot hooks support
index 9d83bb8438879b2fc9679462cf46ae5662ef56d7..9636ce9d3b5d0890f041760b070c130cbff041e0 100644 (file)
@@ -25,6 +25,7 @@
 #include <grub/types.h>
 
 #include <grub/fs.h>
+#include <grub/partition.h>
 
 static grub_device_t
 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->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;
 
   return GRUB_ERR_NONE;