diff --git a/src/dmalloc.h b/src/dmalloc.h
index 5a3ae9be6f52b2dd9775b043911db3359286a326..a73505fb6ff7f13cb586c3cbb8db58dc9579d104 100644
--- a/src/dmalloc.h
+++ b/src/dmalloc.h
@@ -196,7 +196,7 @@ PMOD_EXPORT void* dlmemalign(size_t, size_t);
 PMOD_EXPORT void* dlvalloc(size_t);
 PMOD_EXPORT void* dlpvalloc(size_t);
 PMOD_EXPORT struct mallinfo dlmallinfo(void);
-#define malloc	  dlmalloc
+#define malloc(x) dlmalloc(x)
 #define free	  dlfree
 #define calloc    dlcalloc
 #define realloc	  dlrealloc
diff --git a/src/pike_memory.c b/src/pike_memory.c
index eb3e9b38f2159ffc68ba38f5ba761155bb9c1f17..fc192ca44d306e7736af8a0cc92f98312961b39e 100644
--- a/src/pike_memory.c
+++ b/src/pike_memory.c
@@ -1100,7 +1100,7 @@ static MUTEX_T debug_malloc_mutex;
 #undef ENCAPSULATE_MALLOC
 #define calloc    dlcalloc
 #define free	  dlfree
-#define malloc	  dlmalloc
+#define malloc(x) dlmalloc(x)
 #define memalign  dlmemalign
 #define realloc	  dlrealloc
 #define valloc	  dlvalloc
@@ -1384,7 +1384,7 @@ void *fake_calloc(size_t x, size_t y)
 #define fake_calloc calloc
 #define fake_realloc realloc
 #else
-#define malloc fake_malloc
+#define malloc(x) fake_malloc(x)
 #define free fake_free
 #define realloc fake_realloc
 #define calloc fake_calloc
@@ -1394,7 +1394,7 @@ void *fake_calloc(size_t x, size_t y)
 /* Don't understand what this is supposed to do, but it won't work
  * with USE_DL_MALLOC. /mast */
 #ifdef WRAP
-#define malloc __real_malloc
+#define malloc(x) __real_malloc(x)
 #define free __real_free
 #define realloc __real_realloc
 #define calloc __real_calloc