avoid segfault trying to delete non-copied style
This commit is contained in:
@ -328,7 +328,8 @@ void Update::create_integrate(int narg, char **arg, int trysuffix)
|
||||
|
||||
delete[] integrate_style;
|
||||
delete integrate;
|
||||
integrate_style = nullptr;
|
||||
// temporarily assign the style name without suffix (for error messages during creation)
|
||||
integrate_style = utils::strdup(arg[0]);
|
||||
integrate = nullptr;
|
||||
|
||||
int sflag;
|
||||
@ -349,6 +350,7 @@ void Update::create_integrate(int narg, char **arg, int trysuffix)
|
||||
else if ((sflag == 3) && lmp->non_pair_suffix())
|
||||
estyle += lmp->non_pair_suffix();
|
||||
}
|
||||
delete[] integrate_style;
|
||||
integrate_style = utils::strdup(estyle);
|
||||
}
|
||||
|
||||
@ -398,11 +400,10 @@ void Update::create_minimize(int narg, char **arg, int trysuffix)
|
||||
|
||||
delete[] minimize_style;
|
||||
delete minimize;
|
||||
minimize_style = nullptr;
|
||||
// temporarily assign the style name without suffix (for error messages during creation)
|
||||
minimize_style = utils::strdup(arg[0]);
|
||||
minimize = nullptr;
|
||||
|
||||
// temporarily assign the style name without suffix (for error messages during creation)
|
||||
minimize_style = arg[0];
|
||||
|
||||
int sflag;
|
||||
new_minimize(arg[0], narg - 1, &arg[1], trysuffix, sflag);
|
||||
@ -417,6 +418,7 @@ void Update::create_minimize(int narg, char **arg, int trysuffix)
|
||||
else if ((sflag == 3) && lmp->non_pair_suffix())
|
||||
estyle += lmp->non_pair_suffix();
|
||||
}
|
||||
delete[] minimize_style;
|
||||
minimize_style = utils::strdup(estyle);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user