[MPI] Fixed bugs with memory allocation.
Corrected coding style.