MCPcopy Create free account
hub / github.com/acl-dev/acl / acl_debug_realloc

Function acl_debug_realloc

lib_acl/src/stdlib/debug/acl_debug_malloc.c:83–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83static 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
113static char *acl_debug_strdup(const char *filename, int line, const char *str)
114{

Callers

nothing calls this directly

Calls 6

debug_htable_findFunction · 0.85
debug_htable_deleteFunction · 0.85
freeFunction · 0.85
reallocFunction · 0.85
mallocFunction · 0.85
debug_htable_enterFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…