diff --git a/server-tools/instance-manager/commands.cc b/server-tools/instance-manager/commands.cc
index 7589da859cfbf26e2f91110354efc8d47df84d1a..0f801c8cc7eb17f38e485e2f814308fce3d20180 100644
--- a/server-tools/instance-manager/commands.cc
+++ b/server-tools/instance-manager/commands.cc
@@ -471,6 +471,7 @@ int Show_instance_log::execute(struct st_net *net, ulong connection_id)
       int read_len;
       /* calculate buffer size */
       MY_STAT file_stat;
+      Buffer read_buff;
 
       /* my_fstat doesn't use the flag parameter */
       if (my_fstat(fd, &file_stat, MYF(0)))
@@ -478,13 +479,16 @@ int Show_instance_log::execute(struct st_net *net, ulong connection_id)
 
       buff_size= (size - offset);
 
+      read_buff.reserve(0, buff_size);
+
       /* read in one chunk */
       read_len= my_seek(fd, file_stat.st_size - size, MY_SEEK_SET, MYF(0));
 
-      char *bf= (char*) malloc(sizeof(char)*buff_size);
-      if ((read_len= my_read(fd, (byte*)bf, buff_size, MYF(0))) < 0)
+      if ((read_len= my_read(fd, (byte*) read_buff.buffer,
+                             buff_size, MYF(0))) < 0)
         return ER_READ_FILE;
-      store_to_protocol_packet(&send_buff, (char*) bf, &position, read_len);
+      store_to_protocol_packet(&send_buff, read_buff.buffer,
+                               &position, read_len);
       close(fd);
     }
     else
diff --git a/server-tools/instance-manager/guardian.cc b/server-tools/instance-manager/guardian.cc
index 0d6ebfa8d7955c3def7d72743724d15763a7cbae..4c8f67bd64e6f18c9db69976384c7e5f3343eb0b 100644
--- a/server-tools/instance-manager/guardian.cc
+++ b/server-tools/instance-manager/guardian.cc
@@ -424,23 +424,13 @@ int Guardian_thread::stop_instances(bool stop_instances_arg)
 }
 
 
-int Guardian_thread::lock()
+void Guardian_thread::lock()
 {
-#ifdef __WIN__
   pthread_mutex_lock(&LOCK_guardian); 
-  return 0;
-#else
-  return pthread_mutex_lock(&LOCK_guardian);
-#endif
 }
 
 
-int Guardian_thread::unlock()
+void Guardian_thread::unlock()
 {
-#ifdef __WIN__
   pthread_mutex_unlock(&LOCK_guardian);
-  return 0;
-#else
-  return pthread_mutex_unlock(&LOCK_guardian);
-#endif
 }
diff --git a/server-tools/instance-manager/guardian.h b/server-tools/instance-manager/guardian.h
index 502dc86b2ae2d781f5d949e93ed5ef5827b58cf4..e8992722f3c9552ae04094840cb4e25035f49da9 100644
--- a/server-tools/instance-manager/guardian.h
+++ b/server-tools/instance-manager/guardian.h
@@ -100,8 +100,8 @@ class Guardian_thread: public Guardian_thread_args
   int stop_guard(Instance *instance);
   /* Returns true if guardian thread is stopped */
   int is_stopped();
-  int lock();
-  int unlock();
+  void lock();
+  void unlock();
 
 public:
   pthread_cond_t COND_guardian;
diff --git a/server-tools/instance-manager/instance_map.cc b/server-tools/instance-manager/instance_map.cc
index 802f085aaedb2d3e0fe3c9e31b5e3ef52e04ac06..69eadd7e7652c97eff8213a680875ce6a58fa25b 100644
--- a/server-tools/instance-manager/instance_map.cc
+++ b/server-tools/instance-manager/instance_map.cc
@@ -137,25 +137,15 @@ Instance_map::~Instance_map()
 }
 
 
-int Instance_map::lock()
+void Instance_map::lock()
 {
-#ifdef __WIN__
   pthread_mutex_lock(&LOCK_instance_map);
-  return 0;
-#else
-  return pthread_mutex_lock(&LOCK_instance_map);
-#endif
 }
 
 
-int Instance_map::unlock()
+void Instance_map::unlock()
 {
-#ifdef __WIN__
   pthread_mutex_unlock(&LOCK_instance_map);
-  return 0;
-#else
-  return pthread_mutex_unlock(&LOCK_instance_map);
-#endif
 }
 
 
diff --git a/server-tools/instance-manager/instance_map.h b/server-tools/instance-manager/instance_map.h
index 666a16c7040c19a348c5a73af2eb372cfdaae5da..47037e0d43392e4ddf5496fb2fff9e385953c269 100644
--- a/server-tools/instance-manager/instance_map.h
+++ b/server-tools/instance-manager/instance_map.h
@@ -60,8 +60,8 @@ class Instance_map
   Instance *find(const char *name, uint name_len);
 
   int flush_instances();
-  int lock();
-  int unlock();
+  void lock();
+  void unlock();
   int init();
 
   Instance_map(const char *default_mysqld_path_arg);
diff --git a/server-tools/instance-manager/listener.cc b/server-tools/instance-manager/listener.cc
index d26324a65198e9cf992713f04d157ce53823a810..8fcf23a7397e4a45d9cf416ea5ce491183f8d5c1 100644
--- a/server-tools/instance-manager/listener.cc
+++ b/server-tools/instance-manager/listener.cc
@@ -47,6 +47,7 @@ class Listener_thread: public Listener_thread_args
   ~Listener_thread();
   void run();
 private:
+  static const int LISTEN_BACK_LOG_SIZE= 5;     /* standard backlog size */
   ulong total_connection_count;
   Thread_info thread_info;
 
@@ -59,7 +60,6 @@ class Listener_thread: public Listener_thread_args
   int   create_unix_socket(struct sockaddr_un &unix_socket_address);
 };
 
-const int LISTEN_BACK_LOG_SIZE= 5;         // standard backlog size
 
 Listener_thread::Listener_thread(const Listener_thread_args &args) :
   Listener_thread_args(args.thread_registry, args.options, args.user_map,
@@ -88,13 +88,14 @@ Listener_thread::~Listener_thread()
 
 void Listener_thread::run()
 {
+  int n= 0;
+
+#ifndef __WIN__
   /* we use this var to check whether we are running on LinuxThreads */
   pid_t thread_pid;
-  int n;
 
   thread_pid= getpid();
 
-#ifndef __WIN__
   struct sockaddr_un unix_socket_address;
   /* set global variable */
   linuxthreads= (thread_pid != manager_pid);
@@ -205,7 +206,6 @@ void set_no_inherit(int socket)
 #ifndef __WIN__
   int flags= fcntl(socket, F_GETFD, 0);
   fcntl(socket, F_SETFD, flags | FD_CLOEXEC);
-#else
 #endif
 }
 
diff --git a/server-tools/instance-manager/manager.cc b/server-tools/instance-manager/manager.cc
index 3c809fdfce2fae1da5b75c1528dd0d1806c60ad3..e3daca7189812a1a89bcd4a4989bfeb059d99dc3 100644
--- a/server-tools/instance-manager/manager.cc
+++ b/server-tools/instance-manager/manager.cc
@@ -97,7 +97,6 @@ void set_signals(sigset_t *set)
 
 int my_sigwait(const sigset_t *set, int *sig)
 {
-//  MSG msg;
   while (!have_signal)
   {
     Sleep(100);
diff --git a/server-tools/instance-manager/options.cc b/server-tools/instance-manager/options.cc
index a8e677db6308ec11b04cf4e8c8a0c6fc332c714b..86e21ec8a11c0a1bfade3b0d71d1ae60f5d80f19 100644
--- a/server-tools/instance-manager/options.cc
+++ b/server-tools/instance-manager/options.cc
@@ -32,17 +32,16 @@
 
 const char *default_password_file_name= QUOTE(DEFAULT_PASSWORD_FILE_NAME);
 const char *default_log_file_name= QUOTE(DEFAULT_LOG_FILE_NAME);
-char default_config_file[FN_REFLEN]= "/etc/my.cnf";
+#ifdef __WIN__
+char windows_config_file[FN_REFLEN];
 
-#ifndef __WIN__
-char Options::run_as_service;
-const char *Options::user= 0;                   /* No default value */
-const char *Options::config_file= NULL;
-#else
 char Options::install_as_service;
 char Options::remove_service;
-const char *Options::config_file= QUOTE(DEFAULT_CONFIG_FILE);
+#else
+char Options::run_as_service;
+const char *Options::user= 0;                   /* No default value */
 #endif
+const char *Options::config_file= QUOTE(DEFAULT_CONFIG_FILE);
 const char *Options::log_file_name= default_log_file_name;
 const char *Options::pid_file_name= QUOTE(DEFAULT_PID_FILE_NAME);
 const char *Options::socket_file_name= QUOTE(DEFAULT_SOCKET_FILE_NAME);
@@ -271,9 +270,20 @@ int Options::load(int argc, char **argv)
   */
   if (Options::config_file == NULL)
   {
-    ::GetModuleFileName(NULL, default_config_file, sizeof(default_config_file));    char *filename= strrchr(default_config_file, "\\");
-    strcpy(filename, "\\my.ini");
-    Options::config_file= default_config_file;
+    char *filename;
+    static const char default_win_config_file_name[]= "\\my.ini";
+
+    if (!GetModuleFileName(NULL, windows_config_file,
+                                 sizeof(windows_config_file)))
+      goto err;
+
+    filename= strrchr(windows_config_file, "\\");
+    /*
+      Don't check for the overflow as strlen("\\my.ini") is less
+      then strlen("mysqlmanager") (the binary name)
+    */
+    strcpy(filename, default_win_config_file_name);
+    Options::config_file= windows_config_file;
   }
 #endif