This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/12495] Malloc fails if MALLOC_ALIGNMENT > 2 * SIZE_SZ


http://sourceware.org/bugzilla/show_bug.cgi?id=12495

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> 2011-03-02 02:21:48 UTC ---
The problem is

  /* check that one of the above allocation paths succeeded */
  if ((unsigned long)(size) >= (unsigned long)(nb + MINSIZE)) {
    remainder_size = size - nb;
    remainder = chunk_at_offset(p, nb); 
    av->top = remainder;
    set_head(p, nb | PREV_INUSE | (av != &main_arena ? NON_MAIN_ARENA : 0)); 
    set_head(remainder, remainder_size | PREV_INUSE);
    check_malloced_chunk(av, p, nb); 
    return chunk2mem(p);
  }

We need to properly handle alignment here.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]