diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2010-09-26 20:25:21 +0400 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2010-09-26 20:25:21 +0400 |
commit | f122327288ae4429bb88a0fefdcef0bf80f54023 (patch) | |
tree | ed614bad3d0d1e156e39683da1d30871cad54c94 /accel-pptpd/memdebug.c | |
parent | 863e1de3aa67a03bdf2b9720b32eafe6670b29a3 (diff) | |
download | accel-ppp-xebd-f122327288ae4429bb88a0fefdcef0bf80f54023.tar.gz accel-ppp-xebd-f122327288ae4429bb88a0fefdcef0bf80f54023.zip |
various bug fixed and improvements
Diffstat (limited to 'accel-pptpd/memdebug.c')
-rw-r--r-- | accel-pptpd/memdebug.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/accel-pptpd/memdebug.c b/accel-pptpd/memdebug.c index 780f16b..2acdc7a 100644 --- a/accel-pptpd/memdebug.c +++ b/accel-pptpd/memdebug.c @@ -147,7 +147,34 @@ static void siginfo(int num) printf("total = %lu\n", total); } +static void siginfo2(int num) +{ + struct mem_t *mem; + + spin_lock(&mem_list_lock); + list_for_each_entry(mem, &mem_list, entry) { + if (mem->magic1 != MAGIC1 || mem->magic2 != *(uint64_t*)(mem->data + mem->size)) + printf("%s:%i %lu\n", mem->fname, mem->line, mem->size); + } + spin_unlock(&mem_list_lock); +} + +void __export md_check(void *ptr) +{ + struct mem_t *mem = container_of(ptr, typeof(*mem), data); + + if (!ptr) + abort(); + + if (mem->magic1 != MAGIC1) + abort(); + + if (mem->magic2 != *(uint64_t*)(mem->data + mem->size)) + abort(); +} + static void __init init(void) { signal(36, siginfo); + signal(37, siginfo2); } |