diff options
author | Florian Weimer <fweimer@redhat.com> | 2016-10-28 16:26:57 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2016-10-28 16:45:45 +0200 |
commit | e9c4fe93b3855239752819303ca377dff0ed0553 (patch) | |
tree | a6699b660d68aca544292661543b27b95dda4daf /malloc/hooks.c | |
parent | 4725d33eed118d69b8110285f7741cde9ddc8b4f (diff) | |
download | glibc-e9c4fe93b3855239752819303ca377dff0ed0553.zip glibc-e9c4fe93b3855239752819303ca377dff0ed0553.tar.gz glibc-e9c4fe93b3855239752819303ca377dff0ed0553.tar.bz2 |
malloc: Use accessors for chunk metadata access
This change allows us to change the encoding of these struct members
in a centralized fashion.
Diffstat (limited to 'malloc/hooks.c')
-rw-r--r-- | malloc/hooks.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/malloc/hooks.c b/malloc/hooks.c index ecfe9c1..12995d3 100644 --- a/malloc/hooks.c +++ b/malloc/hooks.c @@ -192,7 +192,7 @@ mem2chunk_check (void *mem, unsigned char **magic_p) ((char *) p < mp_.sbrk_base || ((char *) p + sz) >= (mp_.sbrk_base + main_arena.system_mem))) || sz < MINSIZE || sz & MALLOC_ALIGN_MASK || !inuse (p) || - (!prev_inuse (p) && (p->prev_size & MALLOC_ALIGN_MASK || + (!prev_inuse (p) && ((prev_size (p) & MALLOC_ALIGN_MASK) != 0 || (contig && (char *) prev_chunk (p) < mp_.sbrk_base) || next_chunk (prev_chunk (p)) != p))) return NULL; @@ -215,9 +215,9 @@ mem2chunk_check (void *mem, unsigned char **magic_p) offset != 0x20 && offset != 0x40 && offset != 0x80 && offset != 0x100 && offset != 0x200 && offset != 0x400 && offset != 0x800 && offset != 0x1000 && offset < 0x2000) || - !chunk_is_mmapped (p) || (p->size & PREV_INUSE) || - ((((unsigned long) p - p->prev_size) & page_mask) != 0) || - ((p->prev_size + sz) & page_mask) != 0) + !chunk_is_mmapped (p) || prev_inuse (p) || + ((((unsigned long) p - prev_size (p)) & page_mask) != 0) || + ((prev_size (p) + sz) & page_mask) != 0) return NULL; for (sz -= 1; (c = ((unsigned char *) p)[sz]) != magic; sz -= c) |