summaryrefslogtreecommitdiff
path: root/dbug/dbug.c
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@montyprogram.com>2011-12-02 14:35:26 +0100
committerVladislav Vaintroub <wlad@montyprogram.com>2011-12-02 14:35:26 +0100
commit5beb816a7ec2e39d870f7fd3879dd5ac1e504e23 (patch)
treefa9d4577beb3cfbe5505c5e6c083c163c6957d08 /dbug/dbug.c
parent5d67eb6b5cc8d3643489acc39c545c0993d9777c (diff)
downloadmariadb-git-5beb816a7ec2e39d870f7fd3879dd5ac1e504e23.tar.gz
Make it possible to compile without SAFEMALLOC in debug builds
Default to no SAFEMALLOC on Windows, because C runtime malloc has this functionslity already
Diffstat (limited to 'dbug/dbug.c')
-rw-r--r--dbug/dbug.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/dbug/dbug.c b/dbug/dbug.c
index 3dce91cd2ca..299d3e0d5da 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -2253,6 +2253,9 @@ static void free_memory(void *ptr);
void *_db_malloc_(size_t size)
{
+#ifndef SAFEMALLOC
+ return malloc(size);
+#else
CODE_STATE *cs= code_state();
struct st_irem *irem;
uchar *data;
@@ -2318,10 +2321,14 @@ void *_db_malloc_(size_t size)
TRASH_ALLOC(data, size);
return data;
+#endif
}
void *_db_realloc_(void *ptr, size_t size)
{
+#ifndef SAFEMALLOC
+ return realloc(ptr, size);
+#else
char *data;
if (!ptr)
@@ -2338,15 +2345,19 @@ void *_db_realloc_(void *ptr, size_t size)
free_memory(ptr);
}
return data;
+#endif
}
void _db_free_(void *ptr)
{
+#ifndef SAFEMALLOC
+ free(ptr);
+#else
if (!ptr || bad_ptr("Freeing", ptr))
return;
free_memory(ptr);
- return;
+#endif
}
static void free_memory(void *ptr)