acid leak: handle ALIGN_MAGIC padding of skip area for mallocalign()

the alloc and realloc tag words do not start at the beginning of
a block created by mallocalign(). instead, the block is padded
with ALIGN_MAGIC.
This commit is contained in:
cinap_lenrek 2013-12-17 15:40:12 +01:00
parent 65f426c0bd
commit 0866d65f8e

View file

@ -80,22 +80,27 @@ dumpblock(addr, sum)
a = addr;
complex Alloc a;
x = addr+8;
x = addr+sizeofBhdr;
if addr.magic == ALLOC_MAGIC then {
// for mallocalign()
while *x == ALIGN_MAGIC do {
x = x + 4;
}
}
if sum then {
if *(addr+8) != lastalloc then {
if *x != lastalloc then {
emitsum();
lastalloc = *(addr+8);
lastalloc = *x;
}
lastcount = lastcount+1;
lastsize = lastsize+a.size;
}else{
if addr.magic == ALLOC_MAGIC then
if addr.magic == ALLOC_MAGIC then {
s = "block";
else
} else
s = "free";
print(s, " ", addr\X, " ", a.size\X, " ");
print(*(addr+8)\X, " ", *(addr+12)\X, " ",
*(addr+8)\a, " ", *(addr+12)\a, "\n");
print(*x\X, " ", *(x+4)\X, " ", *x\a, " ", *(x+4)\a, "\n");
}
}
}