aboutsummaryrefslogtreecommitdiff
path: root/lib/memdebug.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-05-11 11:30:23 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-05-11 11:30:23 +0000
commitbbafb2eb27954c34967f91c705e74cc0c186970d (patch)
tree5294d3f6b2a9a5e82949cb03cb1733ba833fa9a3 /lib/memdebug.c
parent434bc13812639c6d76fe4f7b29424b7b21032dc9 (diff)
curl_global_init_mem() allows the memory functions to be replaced.
memory.h is included everywhere for this.
Diffstat (limited to 'lib/memdebug.c')
-rw-r--r--lib/memdebug.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/memdebug.c b/lib/memdebug.c
index 23f975ef6..718391cdb 100644
--- a/lib/memdebug.c
+++ b/lib/memdebug.c
@@ -42,6 +42,7 @@
#endif
#define MEMDEBUG_NODEFINES /* don't redefine the standard functions */
+#include "memory.h"
#include "memdebug.h"
struct memdebug {
@@ -120,7 +121,7 @@ void *curl_domalloc(size_t wantedsize, int line, const char *source)
/* alloc at least 64 bytes */
size = sizeof(struct memdebug)+wantedsize;
- mem=(struct memdebug *)(malloc)(size);
+ mem=(struct memdebug *)(Curl_cmalloc)(size);
if(mem) {
/* fill memory with junk */
memset(mem->mem, 0xA5, wantedsize);
@@ -146,7 +147,7 @@ void *curl_docalloc(size_t wanted_elements, size_t wanted_size,
user_size = wanted_size * wanted_elements;
size = sizeof(struct memdebug) + user_size;
- mem = (struct memdebug *)(malloc)(size);
+ mem = (struct memdebug *)(Curl_cmalloc)(size);
if(mem) {
/* fill memory with zeroes */
memset(mem->mem, 0, user_size);
@@ -197,7 +198,7 @@ void *curl_dorealloc(void *ptr, size_t wantedsize,
if(ptr)
mem = (struct memdebug *)((char *)ptr - offsetof(struct memdebug, mem));
- mem=(struct memdebug *)(realloc)(mem, size);
+ mem=(struct memdebug *)(Curl_crealloc)(mem, size);
if(logfile)
fprintf(logfile, "MEM %s:%d realloc(0x%x, %zd) = %p\n",
source, line, ptr, wantedsize, mem?mem->mem:NULL);
@@ -222,7 +223,7 @@ void curl_dofree(void *ptr, int line, const char *source)
memset(mem->mem, 0x13, mem->size);
/* free for real */
- (free)(mem);
+ (Curl_cfree)(mem);
if(logfile)
fprintf(logfile, "MEM %s:%d free(%p)\n", source, line, ptr);