From 07eb1d443b270a77443100075d0e20df933bcfa6 Mon Sep 17 00:00:00 2001
From: Anders Hafreager <andershaf@gmail.com>
Date: Thu, 25 Aug 2016 15:25:49 +0200
Subject: [PATCH] Fixed initialization of arrays in fixes

---
 src/fix_spring.cpp         | 2 --
 src/fix_spring_chunk.cpp   | 4 ++--
 src/fix_spring_self.cpp    | 3 ++-
 src/fix_store.cpp          | 3 ++-
 src/fix_store_force.cpp    | 3 ++-
 src/fix_store_state.cpp    | 4 +++-
 src/fix_temp_berendsen.cpp | 3 ++-
 7 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/fix_spring.cpp b/src/fix_spring.cpp
index fd1db5749f..9c6bd4084f 100644
--- a/src/fix_spring.cpp
+++ b/src/fix_spring.cpp
@@ -52,8 +52,6 @@ FixSpring::FixSpring(LAMMPS *lmp, int narg, char **arg) :
   respa_level_support = 1;
   ilevel_respa = 0;
 
-  group2 = NULL;
-
   if (strcmp(arg[3],"tether") == 0) {
     if (narg != 9) error->all(FLERR,"Illegal fix spring command");
     styleflag = TETHER;
diff --git a/src/fix_spring_chunk.cpp b/src/fix_spring_chunk.cpp
index 16b3d7939e..773e032388 100644
--- a/src/fix_spring_chunk.cpp
+++ b/src/fix_spring_chunk.cpp
@@ -34,7 +34,8 @@ using namespace FixConst;
 /* ---------------------------------------------------------------------- */
 
 FixSpringChunk::FixSpringChunk(LAMMPS *lmp, int narg, char **arg) :
-  Fix(lmp, narg, arg)
+  Fix(lmp, narg, arg),
+  idchunk(NULL), idcom(NULL), com0(NULL), fcom(NULL)
 {
   if (narg != 6) error->all(FLERR,"Illegal fix spring/chunk command");
 
@@ -55,7 +56,6 @@ FixSpringChunk::FixSpringChunk(LAMMPS *lmp, int narg, char **arg) :
   strcpy(idcom,arg[5]);
 
   esprings = 0.0;
-  com0 = fcom = NULL;
   nchunk = 0;
 }
 
diff --git a/src/fix_spring_self.cpp b/src/fix_spring_self.cpp
index 9517cf0c31..b6d5e3c834 100644
--- a/src/fix_spring_self.cpp
+++ b/src/fix_spring_self.cpp
@@ -32,7 +32,8 @@ using namespace FixConst;
 /* ---------------------------------------------------------------------- */
 
 FixSpringSelf::FixSpringSelf(LAMMPS *lmp, int narg, char **arg) :
-  Fix(lmp, narg, arg)
+  Fix(lmp, narg, arg),
+  xoriginal(NULL)
 {
   if ((narg < 4) || (narg > 5))
     error->all(FLERR,"Illegal fix spring/self command");
diff --git a/src/fix_store.cpp b/src/fix_store.cpp
index cf2553ed08..abfceda264 100644
--- a/src/fix_store.cpp
+++ b/src/fix_store.cpp
@@ -27,7 +27,8 @@ enum{UNKNOWN,GLOBAL,PERATOM};
 
 /* ---------------------------------------------------------------------- */
 
-FixStore::FixStore(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
+FixStore::FixStore(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg),
+vstore(NULL), astore(NULL), rbuf(NULL)
 {
   if (narg != 6) error->all(FLERR,"Illegal fix store command");
 
diff --git a/src/fix_store_force.cpp b/src/fix_store_force.cpp
index f085209287..cfeace5326 100644
--- a/src/fix_store_force.cpp
+++ b/src/fix_store_force.cpp
@@ -26,7 +26,8 @@ using namespace FixConst;
 /* ---------------------------------------------------------------------- */
 
 FixStoreForce::FixStoreForce(LAMMPS *lmp, int narg, char **arg) :
-  Fix(lmp, narg, arg)
+  Fix(lmp, narg, arg),
+  foriginal(NULL)
 {
   if (narg < 3) error->all(FLERR,"Illegal fix store/coord command");
 
diff --git a/src/fix_store_state.cpp b/src/fix_store_state.cpp
index 1c253384e4..e6f3b59d83 100644
--- a/src/fix_store_state.cpp
+++ b/src/fix_store_state.cpp
@@ -37,7 +37,9 @@ enum{KEYWORD,COMPUTE,FIX,VARIABLE,DNAME,INAME};
 /* ---------------------------------------------------------------------- */
 
 FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) :
-  Fix(lmp, narg, arg)
+  Fix(lmp, narg, arg),
+  nvalues(0), which(NULL), argindex(NULL), value2index(NULL), ids(NULL), values(NULL),
+  vbuf(NULL), pack_choice(NULL)
 {
   if (narg < 5) error->all(FLERR,"Illegal fix store/state command");
 
diff --git a/src/fix_temp_berendsen.cpp b/src/fix_temp_berendsen.cpp
index bb86eb4866..aff9a44977 100644
--- a/src/fix_temp_berendsen.cpp
+++ b/src/fix_temp_berendsen.cpp
@@ -35,7 +35,8 @@ enum{CONSTANT,EQUAL};
 /* ---------------------------------------------------------------------- */
 
 FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) :
-  Fix(lmp, narg, arg)
+  Fix(lmp, narg, arg),
+  tstr(NULL), id_temp(NULL), tflag(0)
 {
   if (narg != 6) error->all(FLERR,"Illegal fix temp/berendsen command");
 
-- 
GitLab