diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-12-17 15:40:12 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-12-17 15:40:12 +0100 |
commit | 0866d65f8ea7d43329659cc22e38970541946ea3 (patch) | |
tree | de9797c4967e60588c4967277f9b15fe565a5e93 /sys | |
parent | 65f426c0bd4f2e4832364e2e54b440848c743b76 (diff) |
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.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/lib/acid/leak | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sys/lib/acid/leak b/sys/lib/acid/leak index 7469287a2..6376d5a9a 100644 --- a/sys/lib/acid/leak +++ b/sys/lib/acid/leak @@ -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"); } } } |