From cf19197f79d6b7f4a9a37c9ef91f868c2e2fcd94 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 16 Mar 2021 10:03:22 -0400 Subject: [PATCH] revert change causing memory corruption. we need extra space in the allocated string buffer. --- src/thermo.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/thermo.cpp b/src/thermo.cpp index eb4cc0f5ff..01dd9e0750 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -125,12 +125,12 @@ Thermo::Thermo(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) int nvalues = utils::expand_args(FLERR,narg-1,&arg[1],0,earg,lmp); if (earg != &arg[1]) expand = 1; - std::string concat; + line = new char[256+nvalues*64]; + line[0] = '\0'; for (int iarg = 0; iarg < nvalues; iarg++) { - concat += earg[iarg]; - concat += " "; + strcat(line,earg[iarg]); + strcat(line," "); } - line = utils::strdup(concat); line[strlen(line)-1] = '\0'; // if wildcard expansion occurred, free earg memory from exapnd_args()