fix two memory allocation/deallocation bugs in pair style comb3

This commit is contained in:
Axel Kohlmeyer
2020-05-26 19:56:28 -04:00
parent 151d1fb42b
commit ff3ebd4f6a

View File

@ -594,9 +594,9 @@ void PairComb3::read_file(char *file)
int params_per_line = 74;
char **words = new char*[params_per_line+1];
if (params) delete [] params;
memory->sfree(params);
params = NULL;
nparams = 0;
nparams = maxparam = 0;
// open file on proc 0
@ -656,9 +656,9 @@ void PairComb3::read_file(char *file)
if ((ptr = strchr(line,'#'))) *ptr = '\0';
nwords = atom->count_words(line);
}
if (nwords != params_per_line){
if (nwords != params_per_line) {
error->all(FLERR,"Incorrect format in COMB3 potential file");
}
}
// words = ptrs to all words in line
nwords = 0;