diff --git a/src/main.c b/src/main.c
old mode 100644
new mode 100755
index e1ce19ed78ee6d11cabadc86e79311ca0e0df7ed..58eb4d4e0d36af54606e67db9a6ba7dc7b959b3c
--- a/src/main.c
+++ b/src/main.c
@@ -98,7 +98,13 @@ static void set_master(const char *file)
 {
   if( master_file_location != _master_location+CONSTANT_STRLEN(MASTER_COOKIE))
     free((void*)master_file_location);
+#if DEBUG_MALLOC
+#ifndef __NT__
 #undef strdup /* We can't use dmalloc strdup before pike_memory is initialized. */
+#else
+#define strdup _strdup
+#endif /* __NT__ */
+#endif /* DEBUG_MALLOC */
   master_file_location = strdup( file );
 }
 
@@ -106,7 +112,7 @@ static void set_master(const char *file)
 static void get_master_key(HKEY cat)
 {
   HKEY k;
-  char buffer[4096];
+  char * buffer = malloc(4096);
   DWORD len=sizeof(buffer)-1,type=REG_SZ;
 
   if(RegOpenKeyEx(cat,
@@ -163,7 +169,7 @@ static void set_default_master(const char *bin_name)
       fprintf (stderr, "Failed to get path to exe file: %d\n",
 	       GetLastError());
     else {
-      char tmp[MAXPATHLEN * 2];
+      char * tmp = malloc(MAXPATHLEN * 2);
       char *p = strrchr (exepath, '\\');
       if (p) *p = 0;
       SNPRINTF (tmp, sizeof (tmp), "%s/%s", exepath, mp);
@@ -295,7 +301,6 @@ int main(int argc, char **argv)
   JMP_BUF back;
   int e, num;
   char *p;
-
 #ifdef PIKE_EXTRA_DEBUG
   if (sizeof(void *) == 8) {
     /* 64-bit Solaris 10 in Xenofarm fails with SIGPIPE.