[2146] 2009-04-27 Pavel Roskin <[email protected]>

Pavel Roskin <[email protected]>
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 2146
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2146
Author:   proski
Date:     2009-04-28 13:14:20 +0000 (Tue, 28 Apr 2009)
Log Message:
-----------
2009-04-27  Pavel Roskin  <[email protected]>

	* 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.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/disk/fs_uuid.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2009-04-27 16:48:58 UTC (rev 2145)
+++ trunk/grub2/ChangeLog	2009-04-28 13:14:20 UTC (rev 2146)
@@ -1,3 +1,9 @@
+2009-04-28  Pavel Roskin  <[email protected]>
+
+	* 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 <[email protected]>
 
 	Preboot hooks support

Modified: trunk/grub2/disk/fs_uuid.c
===================================================================
--- trunk/grub2/disk/fs_uuid.c	2009-04-27 16:48:58 UTC (rev 2145)
+++ trunk/grub2/disk/fs_uuid.c	2009-04-28 13:14:20 UTC (rev 2146)
@@ -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 @@
 
   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;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.