diff --git a/lib/atc/LammpsInterface.cpp b/lib/atc/LammpsInterface.cpp index 78859aec6f..d584d159ea 100644 --- a/lib/atc/LammpsInterface.cpp +++ b/lib/atc/LammpsInterface.cpp @@ -235,6 +235,7 @@ std::string LammpsInterface::read_file(std::string filename) const eof = lammps_->comm->read_lines_from_file(fp,1,MAXLINE,buffer); s << buffer; } + fclose(fp); delete [] buffer; return s.str(); // can't copy the stream itself } diff --git a/lib/atc/ParDiagonalMatrix.cpp b/lib/atc/ParDiagonalMatrix.cpp index 15690b32ed..5888bedc04 100644 --- a/lib/atc/ParDiagonalMatrix.cpp +++ b/lib/atc/ParDiagonalMatrix.cpp @@ -88,6 +88,10 @@ namespace ATC_matrix { // Collect results on all processors allgatherv(_comm, C.ptr() + myMajorOffset * nMinor, myNMajor * nMinor, C.ptr(), majorCounts, majorOffsets); + + delete[] majorCounts; + delete[] majorOffsets; } + } // end namespace diff --git a/lib/atc/Utility.h b/lib/atc/Utility.h index f3bbd7d1fb..f9e99ff194 100644 --- a/lib/atc/Utility.h +++ b/lib/atc/Utility.h @@ -204,7 +204,9 @@ namespace ATC_Utility { double v; std::istringstream in(s); - return (in >> v); + in >> v; + // in.good() == true indicates, that not the whole string was converted. + return !(in.fail() || in.good()); } /** convert a string to anything that has iostream::>> defined, second arg is to disambibuate type */