From ff3ebd4f6a94004db48dab42ff18bfa396af9ea4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 26 May 2020 19:56:28 -0400 Subject: [PATCH] fix two memory allocation/deallocation bugs in pair style comb3 --- src/MANYBODY/pair_comb3.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index bf66ea550a..a79d919d64 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -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;