NULLing pointers after delete
This commit is contained in:
@ -390,6 +390,8 @@ void Atom::create_avec(const char *style, int narg, char **arg, int trysuffix)
|
||||
{
|
||||
delete [] atom_style;
|
||||
if (avec) delete avec;
|
||||
atom_style = NULL;
|
||||
avec = NULL;
|
||||
|
||||
// unset atom style and array existence flags
|
||||
// may have been set by old avec
|
||||
|
||||
@ -195,6 +195,8 @@ void Force::create_pair(const char *style, int trysuffix)
|
||||
{
|
||||
delete [] pair_style;
|
||||
if (pair) delete pair;
|
||||
pair_style = NULL;
|
||||
pair = NULL;
|
||||
|
||||
int sflag;
|
||||
pair = new_pair(style,trysuffix,sflag);
|
||||
|
||||
Reference in New Issue
Block a user