diff --git a/src/MISC/fix_imd.cpp b/src/MISC/fix_imd.cpp index 0dbafe49cb..04adcabd34 100644 --- a/src/MISC/fix_imd.cpp +++ b/src/MISC/fix_imd.cpp @@ -581,9 +581,8 @@ FixIMD::FixIMD(LAMMPS *lmp, int narg, char **arg) : msglen += 3*4*num_coords+IMDHEADERSIZE; } msgdata = new char[msglen]; - } - else { - msglen = 3*sizeof(float)*num_coords+IMDHEADERSIZE; + } else { + msglen = 3*(int)sizeof(float)*num_coords+IMDHEADERSIZE; msgdata = new char[msglen]; } diff --git a/src/SHOCK/fix_append_atoms.cpp b/src/SHOCK/fix_append_atoms.cpp index 677b3b55fd..3f15d13df2 100644 --- a/src/SHOCK/fix_append_atoms.cpp +++ b/src/SHOCK/fix_append_atoms.cpp @@ -49,7 +49,6 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : scaleflag = 1; spatflag=0; - spatialid = nullptr; size = 0.0; xloflag = xhiflag = yloflag = yhiflag = zloflag = zhiflag = 0; @@ -60,9 +59,6 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : rany = 0.0; ranz = 0.0; - randomx = nullptr; - randomt = nullptr; - if (domain->lattice->nbasis == 0) error->all(FLERR,"Fix append/atoms requires a lattice be defined"); @@ -123,6 +119,7 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg+1],"f_") == 0) error->all(FLERR, "Bad fix ID in fix append/atoms command"); spatflag = 1; + delete[] spatialid; spatialid = utils::strdup(arg[iarg+1]+2); spatlead = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; @@ -152,6 +149,7 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : ranz = utils::numeric(FLERR,arg[iarg+3],false,lmp); xseed = utils::inumeric(FLERR,arg[iarg+4],false,lmp); if (xseed <= 0) error->all(FLERR,"Illegal fix append/atoms command"); + delete randomx; randomx = new RanMars(lmp,xseed + comm->me); iarg += 5; } else if (strcmp(arg[iarg],"temp") == 0) { @@ -165,7 +163,10 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : if (t_period <= 0) error->all(FLERR,"Illegal fix append/atoms command"); if (t_extent <= 0) error->all(FLERR,"Illegal fix append/atoms command"); if (tseed <= 0) error->all(FLERR,"Illegal fix append/atoms command"); + delete randomt; randomt = new RanMars(lmp,tseed + comm->me); + delete[] gfactor1; + delete[] gfactor2; gfactor1 = new double[atom->ntypes+1]; gfactor2 = new double[atom->ntypes+1]; iarg += 5; diff --git a/src/VORONOI/compute_voronoi_atom.cpp b/src/VORONOI/compute_voronoi_atom.cpp index 4aa6ebf559..12ea173a23 100644 --- a/src/VORONOI/compute_voronoi_atom.cpp +++ b/src/VORONOI/compute_voronoi_atom.cpp @@ -55,16 +55,10 @@ ComputeVoronoi::ComputeVoronoi(LAMMPS *lmp, int narg, char **arg) : surface = VOROSURF_NONE; maxedge = 0; fthresh = ethresh = 0.0; - radstr = nullptr; onlyGroup = false; occupation = false; - con_mono = nullptr; - con_poly = nullptr; - tags = nullptr; oldmaxtag = 0; - occvec = sendocc = lroot = lnext = nullptr; - faces = nullptr; int iarg = 3; while (iarg narg || strstr(arg[iarg+1],"v_") != arg[iarg+1] ) error->all(FLERR,"Illegal compute voronoi/atom command"); + delete[] radstr; radstr = utils::strdup(&arg[iarg+1][2]); iarg += 2; } diff --git a/src/respa.cpp b/src/respa.cpp index fb54582553..086371ecbb 100644 --- a/src/respa.cpp +++ b/src/respa.cpp @@ -125,6 +125,8 @@ Respa::Respa(LAMMPS *lmp, int narg, char **arg) : nhybrid_styles = hybrid->nstyles; // each hybrid sub-style needs to be assigned to a respa level if (iarg + nhybrid_styles > narg) error->all(FLERR, "Illegal run_style respa command"); + delete[] hybrid_level; + delete[] hybrid_compute; hybrid_level = new int[nhybrid_styles]; hybrid_compute = new int[nhybrid_styles]; for (int i = 0; i < nhybrid_styles; ++i) {