CVS: winex/libs/ptmalloc3 malloc.c,1.5,1.6
[email protected] 30 Mar 2007 20:42:37 -0000
Newsgroups
gmane.comp.emulators.winex.cvs
Message-ID
<[email protected] >
Subject: winex/libs/ptmalloc3 malloc.c,1.5,1.6Update of /var/lib/cvsd/cvsroot/winex/libs/ptmalloc3
In directory agravaine:/tmp/cvs-serv20662/libs/ptmalloc3
Modified Files:
malloc.c
Log Message:
- fix deallocation of 16-byte-aligned large allocations
Index: malloc.c
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/libs/ptmalloc3/malloc.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- malloc.c 30 Mar 2007 20:28:04 -0000 1.5
+++ malloc.c 30 Mar 2007 20:42:35 -0000 1.6
@@ -3626,11 +3626,11 @@
#endif
else {
size_t offset = oldp->prev_foot & ~IS_MMAPPED_BIT;
- size_t oldmmsize = oldsize + offset + MMAP_FOOT_PAD;
size_t newmmsize = mmap_align(nb + MMAP_CHUNK_OVERHEAD + MMAP_FOOT_PAD +
CHUNK_ALIGN_MASK);
lmsegmentptr lseg =
(lmsegmentptr)((char *)oldp + oldsize + FOUR_SIZE_T_SIZES);
+ size_t oldmmsize = lseg->size + offset + MMAP_FOOT_PAD;
if (lseg->prev)
lseg->prev->next = lseg->next;
else
@@ -3638,8 +3638,8 @@
if (lseg->next)
lseg->next->prev = lseg->prev;
- char* cp = (char*)CALL_MREMAP((char*)oldp - offset,
- oldmmsize, newmmsize, 1);
+ char* cp = (char*)CALL_MREMAP(mem2chunk (lseg->base), oldmmsize,
+ newmmsize, 1);
if (cp != CMFAIL) {
mchunkptr newp = (mchunkptr)(cp + offset);
size_t psize = newmmsize - offset - MMAP_FOOT_PAD;
@@ -5140,6 +5140,7 @@
if (!pinuse(p)) {
size_t prevsize = p->prev_foot;
if ((prevsize & IS_MMAPPED_BIT) != 0) {
+ size_t mmsize;
prevsize &= ~IS_MMAPPED_BIT;
psize += prevsize + MMAP_FOOT_PAD;
@@ -5152,8 +5153,9 @@
if (lseg->next)
lseg->next->prev = lseg->prev;
- if (CALL_MUNMAP((char*)p - prevsize, psize) == 0)
- fm->footprint -= psize;
+ mmsize = lseg->size + prevsize + MMAP_FOOT_PAD;
+ if (CALL_MUNMAP(mem2chunk (lseg->base), mmsize) == 0)
+ fm->footprint -= mmsize;
goto postaction;
}
else {