diff --git a/src/main.c b/src/main.c
index 41a08e85639c01f28e42f323fc4bd64e96c2e820..94935fb3d613a236d111a7e480522566a971fb6b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -97,7 +97,7 @@ static const char *master_file_location = _master_location + CONSTANT_STRLEN(MAS
 static void set_master(const char *file)
 {
   if( master_file_location != _master_location+CONSTANT_STRLEN(MASTER_COOKIE))
-    free(master_file_location);
+    free((void*)master_file_location);
 #undef strdup /* We can't use dmalloc strdup before pike_memory is initialized. */
   master_file_location = strdup( file );
 }