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:
parent
65f426c0bd
commit
0866d65f8e
1 changed files with 12 additions and 7 deletions
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue