Fixing some minor memory leaks

This commit is contained in:
Mark Berrill 2015-08-31 11:44:38 -04:00
parent 704f391d0f
commit 8096b7e885

View File

@ -209,11 +209,10 @@ int main(int argc, char **argv)
// Read in sphere pack (initialize the non-wetting phase as inside of spheres)
if (rank==1) printf("nspheres =%i \n",nspheres);
//.......................................................................
double *cx,*cy,*cz,*rad;
cx = new double[nspheres];
cy = new double[nspheres];
cz = new double[nspheres];
rad = new double[nspheres];
double *cx = new double[nspheres];
double *cy = new double[nspheres];
double *cz = new double[nspheres];
double *rad = new double[nspheres];
//.......................................................................
if (rank == 0) printf("Reading the sphere packing \n");
if (rank == 0) ReadSpherePacking(nspheres,cx,cy,cz,rad);
@ -282,6 +281,12 @@ int main(int argc, char **argv)
if (rank==0) printf("reducing averages \n");
// Averages.Reduce();
// Free memory
delete [] cx;
delete [] cy;
delete [] cz;
delete [] rad;
} // Limit scope so variables that contain communicators will free before MPI_Finialize
MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize();