* kern/mm.c (grub_real_malloc): Fix size calculation when extra == 0.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-05-03 12:53:32 +02:00
parent d1b61374ed
commit 2589383147
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
* kern/mm.c (grub_real_malloc): Fix size calculation when extra == 0.
2010-05-01 Christian Franke <franke@computer.org>
* util/grub-mkconfig_lib.in (make_system_path_relative_to_its_root):

View File

@ -251,13 +251,20 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align)
grub_mm_header_t r;
p->magic = GRUB_MM_ALLOC_MAGIC;
p->size = n;
r = p + extra + n;
r->magic = GRUB_MM_FREE_MAGIC;
r->size = p->size - extra - n;
r->next = p->next;
q->next = r;
if (q == p)
{
q = r;
r->next = r;
}
p->size = n;
}
else
{