make sure all class pointers in the LAMMPS class are initialized to NULL

some early use of the LAMMPS class may produce segmentation faults,
if member classes are not yet initialized and their pointers are
pointing to random locations. For NULL we can easily test.
This commit is contained in:
Axel Kohlmeyer
2018-12-07 04:34:00 -05:00
parent a5f75bbabd
commit c44620f00e

View File

@ -65,13 +65,15 @@ static void print_style(FILE *fp, const char *str, int &pos);
input is allocated at end after MPI info is setup
------------------------------------------------------------------------- */
LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
memory(NULL), error(NULL), universe(NULL), input(NULL), atom(NULL),
update(NULL), neighbor(NULL), comm(NULL), domain(NULL), force(NULL),
modify(NULL), group(NULL), output(NULL), timer(NULL), kokkos(NULL),
atomKK(NULL), memoryKK(NULL), python(NULL), citeme(NULL)
{
memory = new Memory(this);
error = new Error(this);
universe = new Universe(this,communicator);
output = NULL;
python = NULL;
clientserver = 0;
cslib = NULL;