ref: 0866d65f8ea7d43329659cc22e38970541946ea3
parent: 65f426c0bd4f2e4832364e2e54b440848c743b76
author: cinap_lenrek <[email protected]>
date: Tue Dec 17 10:40:12 EST 2013
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.
--- a/sys/lib/acid/leak
+++ b/sys/lib/acid/leak
@@ -80,22 +80,27 @@
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");
}
}
}