avoid illegal free()
This commit is contained in:
@ -1913,6 +1913,7 @@ void Input::suffix()
|
|||||||
|
|
||||||
delete [] lmp->suffix;
|
delete [] lmp->suffix;
|
||||||
delete [] lmp->suffix2;
|
delete [] lmp->suffix2;
|
||||||
|
lmp->suffix = lmp->suffix2 = nullptr;
|
||||||
|
|
||||||
if (strcmp(arg[0],"hybrid") == 0) {
|
if (strcmp(arg[0],"hybrid") == 0) {
|
||||||
if (narg != 3) error->all(FLERR,"Illegal suffix command");
|
if (narg != 3) error->all(FLERR,"Illegal suffix command");
|
||||||
@ -1927,7 +1928,6 @@ void Input::suffix()
|
|||||||
int n = strlen(arg[0]) + 1;
|
int n = strlen(arg[0]) + 1;
|
||||||
lmp->suffix = new char[n];
|
lmp->suffix = new char[n];
|
||||||
strcpy(lmp->suffix,arg[0]);
|
strcpy(lmp->suffix,arg[0]);
|
||||||
lmp->suffix2 = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -335,7 +335,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
|
|||||||
error->universe_all(FLERR,"Invalid command-line argument");
|
error->universe_all(FLERR,"Invalid command-line argument");
|
||||||
delete [] suffix;
|
delete [] suffix;
|
||||||
delete [] suffix2;
|
delete [] suffix2;
|
||||||
suffix2 = NULL;
|
suffix = suffix2 = NULL;
|
||||||
suffix_enable = 1;
|
suffix_enable = 1;
|
||||||
// hybrid option to set fall-back for suffix2
|
// hybrid option to set fall-back for suffix2
|
||||||
if (strcmp(arg[iarg+1],"hybrid") == 0) {
|
if (strcmp(arg[iarg+1],"hybrid") == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user