From 42bbeb3f16cfea0bb2711c6297264ebcb718acb3 Mon Sep 17 00:00:00 2001 From: Anders Hafreager Date: Wed, 4 Jan 2017 16:04:05 +0100 Subject: [PATCH] NULLing pointers after delete --- src/atom.cpp | 2 ++ src/force.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/atom.cpp b/src/atom.cpp index 053a18430b..6b3427c04e 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -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 diff --git a/src/force.cpp b/src/force.cpp index 95a6ff4f6d..3dd28cc710 100644 --- a/src/force.cpp +++ b/src/force.cpp @@ -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);