[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[2405] 2009-07-13 Pavel Roskin <address@hidden>
From: |
Pavel Roskin |
Subject: |
[2405] 2009-07-13 Pavel Roskin <address@hidden> |
Date: |
Mon, 13 Jul 2009 22:21:49 +0000 |
Revision: 2405
http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2405
Author: proski
Date: 2009-07-13 22:21:49 +0000 (Mon, 13 Jul 2009)
Log Message:
-----------
2009-07-13 Pavel Roskin <address@hidden>
* kern/device.c (grub_device_iterate): Change struct part_ent to
hold the name, not a pointer to it. Use one grub_malloc() per
partition, not two. Free partition_name if grub_malloc() fails.
Set ents to NULL only before grub_partition_iterate() is called.
Modified Paths:
--------------
trunk/grub2/ChangeLog
trunk/grub2/kern/device.c
Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog 2009-07-11 03:59:15 UTC (rev 2404)
+++ trunk/grub2/ChangeLog 2009-07-13 22:21:49 UTC (rev 2405)
@@ -1,3 +1,10 @@
+2009-07-13 Pavel Roskin <address@hidden>
+
+ * kern/device.c (grub_device_iterate): Change struct part_ent to
+ hold the name, not a pointer to it. Use one grub_malloc() per
+ partition, not two. Free partition_name if grub_malloc() fails.
+ Set ents to NULL only before grub_partition_iterate() is called.
+
2009-07-11 Bean <address@hidden>
* kern/ieee1275/openfw.c (grub_children_iterate): Fix size of
Modified: trunk/grub2/kern/device.c
===================================================================
--- trunk/grub2/kern/device.c 2009-07-11 03:59:15 UTC (rev 2404)
+++ trunk/grub2/kern/device.c 2009-07-13 22:21:49 UTC (rev 2405)
@@ -86,8 +86,8 @@
struct part_ent
{
struct part_ent *next;
- char *name;
- } *ents = NULL;
+ char name[0];
+ } *ents;
int iterate_disk (const char *disk_name)
{
@@ -105,18 +105,17 @@
struct part_ent *p;
int ret = 0;
+ ents = NULL;
(void) grub_partition_iterate (dev->disk, iterate_partition);
grub_device_close (dev);
p = ents;
- ents = NULL;
while (p != NULL)
{
struct part_ent *next = p->next;
if (!ret)
ret = hook (p->name);
- grub_free (p->name);
grub_free (p);
p = next;
}
@@ -137,15 +136,10 @@
if (! partition_name)
return 1;
- p = grub_malloc (sizeof (*p));
+ p = grub_malloc (sizeof (p->next) + grub_strlen (disk->name) + 1 +
+ grub_strlen (partition_name) + 1);
if (!p)
- return 1;
-
- p->name = grub_malloc (grub_strlen (disk->name) + 1
- + grub_strlen (partition_name) + 1);
- if (! p->name)
{
- grub_free (p);
grub_free (partition_name);
return 1;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [2405] 2009-07-13 Pavel Roskin <address@hidden>,
Pavel Roskin <=