2010-03-06 Vladimir Serbinenko <phcoder@gmail.com>

* loader/i386/bsd.c (grub_bsd_get_device): Fix a memory leak.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-03-06 17:27:28 +01:00
parent 2ac227c7f4
commit b1f6d291ad
2 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,7 @@
2010-03-06 Vladimir Serbinenko <phcoder@gmail.com>
* loader/i386/bsd.c (grub_bsd_get_device): Fix a memory leak.
2010-03-06 Vladimir Serbinenko <phcoder@gmail.com> 2010-03-06 Vladimir Serbinenko <phcoder@gmail.com>
* loader/i386/multiboot_mbi.c (grub_multiboot_set_bootdev): Free the * loader/i386/multiboot_mbi.c (grub_multiboot_set_bootdev): Free the

View file

@ -154,8 +154,8 @@ grub_bsd_get_device (grub_uint32_t * biosdev,
dev = grub_device_open (0); dev = grub_device_open (0);
if (dev && dev->disk && dev->disk->partition) if (dev && dev->disk && dev->disk->partition)
{ {
char *p0;
p = dev->disk->partition->partmap->get_name (dev->disk->partition); p0 = p = dev->disk->partition->partmap->get_name (dev->disk->partition);
if (p) if (p)
{ {
if ((p[0] >= '0') && (p[0] <= '9')) if ((p[0] >= '0') && (p[0] <= '9'))
@ -169,6 +169,7 @@ grub_bsd_get_device (grub_uint32_t * biosdev,
if ((p[0] >= 'a') && (p[0] <= 'z')) if ((p[0] >= 'a') && (p[0] <= 'z'))
*part = p[0] - 'a'; *part = p[0] - 'a';
} }
grub_free (p0);
} }
if (dev) if (dev)
grub_device_close (dev); grub_device_close (dev);