| 81 | } |
| 82 | |
| 83 | static void *acl_debug_realloc(const char *filename, int line, void *old, size_t size) |
| 84 | { |
| 85 | char key[256], *value; |
| 86 | void *ptr; |
| 87 | |
| 88 | ASSERT(__debug_mem); |
| 89 | |
| 90 | snprintf(key, sizeof(key), "0x%p", old); |
| 91 | LOCK; |
| 92 | value = (char*) debug_htable_find(__debug_mem->table, key); |
| 93 | if (value == NULL) { |
| 94 | fprintf(__debug_mem->dump_fp, "corrumpt%c%s%c%d\n", SEP, filename, SEP, line); |
| 95 | } else { |
| 96 | debug_htable_delete(__debug_mem->table, key, NULL); |
| 97 | free(value); |
| 98 | } |
| 99 | UNLOCK; |
| 100 | |
| 101 | ptr = realloc(old, size); |
| 102 | ASSERT(ptr); |
| 103 | snprintf(key, sizeof(key), "0x%p", ptr); |
| 104 | value = (char*) malloc(DLEN); |
| 105 | ASSERT(value); |
| 106 | snprintf(value, DLEN, "%s%c%d%c%d", filename, SEP, line, SEP, (int) size); |
| 107 | LOCK; |
| 108 | ASSERT(debug_htable_enter(__debug_mem->table, key, value)); |
| 109 | UNLOCK; |
| 110 | return (ptr); |
| 111 | } |
| 112 | |
| 113 | static char *acl_debug_strdup(const char *filename, int line, const char *str) |
| 114 | { |
nothing calls this directly
no test coverage detected
searching dependent graphs…