* kern/mm.c (grub_real_malloc): Fix size calculation when extra == 0.
This commit is contained in:
parent
d1b61374ed
commit
2589383147
2 changed files with 12 additions and 1 deletions
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue