From 3988c4a09fe26ffb917ce07170a6fb78654b64db Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 22 Jun 2012 23:54:43 +0200 Subject: [PATCH] * grub-core/kern/mm.c (get_header_from_pointer): Put a more informative message on double free. Put the value of magic in case of mismatch. --- ChangeLog | 5 +++++ grub-core/kern/mm.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3b0d41a6f..5f823b9e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-06-22 Vladimir Serbinenko + + * grub-core/kern/mm.c (get_header_from_pointer): Put a more informative + message on double free. Put the value of magic in case of mismatch. + 2012-06-22 Vladimir Serbinenko Speed-up video on yeeloong. diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c index 95dd5ddf1..7f240779f 100644 --- a/grub-core/kern/mm.c +++ b/grub-core/kern/mm.c @@ -98,8 +98,11 @@ get_header_from_pointer (void *ptr, grub_mm_header_t *p, grub_mm_region_t *r) grub_fatal ("out of range pointer %p", ptr); *p = (grub_mm_header_t) ptr - 1; + if ((*p)->magic == GRUB_MM_FREE_MAGIC) + grub_fatal ("double free at %p", *p); if ((*p)->magic != GRUB_MM_ALLOC_MAGIC) - grub_fatal ("alloc magic is broken at %p", *p); + grub_fatal ("alloc magic is broken at %p: %lx", *p, + (unsigned long) (*p)->magic); } /* Initialize a region starting from ADDR and whose size is SIZE,