=== modified file 'sql/rpl_parallel.cc'
--- sql/rpl_parallel.cc	2014-11-17 11:42:02 +0000
+++ sql/rpl_parallel.cc	2014-11-25 11:44:42 +0000
@@ -925,6 +925,7 @@
                                  uint32 new_count, bool skip_check)
 {
   uint32 i;
+  rpl_parallel_thread **old_list= NULL;
   rpl_parallel_thread **new_list= NULL;
   rpl_parallel_thread *new_free_list= NULL;
   rpl_parallel_thread *rpt_array= NULL;
@@ -1029,10 +1030,14 @@
     }
   }
 
-  my_free(pool->threads);
+  old_list= pool->threads;
+  if (new_count < pool->count)
+    pool->count= new_count;
   pool->threads= new_list;
+  if (new_count > pool->count)
+    pool->count= new_count;
+  my_free(old_list);
   pool->free_list= new_free_list;
-  pool->count= new_count;
   for (i= 0; i < pool->count; ++i)
   {
     mysql_mutex_lock(&pool->threads[i]->LOCK_rpl_thread);

