fix unlikely memory leaks

This commit is contained in:
Axel Kohlmeyer
2025-07-04 17:12:12 -04:00
parent d34fc34e7b
commit 5fa2b88011
2 changed files with 6 additions and 2 deletions

View File

@ -73,15 +73,18 @@ ComputeMLIAP::ComputeMLIAP(LAMMPS *lmp, int narg, char **arg) :
if (strcmp(arg[iarg],"model") == 0) {
if (iarg+2 > narg) utils::missing_cmd_args(FLERR,"compute mliap model", error);
if (strcmp(arg[iarg+1],"linear") == 0) {
delete model;
model = new MLIAPModelLinear(lmp);
iarg += 2;
} else if (strcmp(arg[iarg+1],"quadratic") == 0) {
delete model;
model = new MLIAPModelQuadratic(lmp);
iarg += 2;
#ifdef MLIAP_PYTHON
} else if (strcmp(arg[iarg+1],"mliappy") == 0) {
model = new MLIAPModelPython(lmp);
iarg += 2;
delete model;
model = new MLIAPModelPython(lmp);
iarg += 2;
#else
} else if (strcmp(arg[iarg+1],"mliappy") == 0) {
error->all(FLERR, "Must enable PYTHON package and -DMLIAP_PYTHON setting to use "

View File

@ -91,6 +91,7 @@ FixEHEX::FixEHEX(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR, "Illegal fix ehex command: wrong number of parameters ");
region = domain->get_region_by_id(arg[iarg + 1]);
if (!region) error->all(FLERR, "Region {} for fix ehex does not exist", arg[iarg + 1]);
delete[] idregion;
idregion = utils::strdup(arg[iarg + 1]);
iarg += 2;
}