set lmp pointer to NULL after delete to avoid using it or deleting it a second time
This commit is contained in:
@ -53,12 +53,13 @@ using ::testing::StartsWith;
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
void cleanup_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
void cleanup_lammps(LAMMPS *&lmp, const TestConfig &cfg)
|
||||
{
|
||||
platform::unlink(cfg.basename + ".restart");
|
||||
platform::unlink(cfg.basename + ".data");
|
||||
platform::unlink(cfg.basename + "-coeffs.in");
|
||||
delete lmp;
|
||||
lmp = nullptr;
|
||||
}
|
||||
|
||||
LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton)
|
||||
|
||||
@ -53,12 +53,13 @@ using ::testing::StartsWith;
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
void cleanup_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
void cleanup_lammps(LAMMPS *&lmp, const TestConfig &cfg)
|
||||
{
|
||||
platform::unlink(cfg.basename + ".restart");
|
||||
platform::unlink(cfg.basename + ".data");
|
||||
platform::unlink(cfg.basename + "-coeffs.in");
|
||||
delete lmp;
|
||||
lmp = nullptr;
|
||||
}
|
||||
|
||||
LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton)
|
||||
|
||||
@ -53,12 +53,13 @@ using ::testing::StartsWith;
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
void cleanup_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
void cleanup_lammps(LAMMPS *&lmp, const TestConfig &cfg)
|
||||
{
|
||||
platform::unlink(cfg.basename + ".restart");
|
||||
platform::unlink(cfg.basename + ".data");
|
||||
platform::unlink(cfg.basename + "-coeffs.in");
|
||||
delete lmp;
|
||||
lmp = nullptr;
|
||||
}
|
||||
|
||||
LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton)
|
||||
|
||||
@ -56,10 +56,11 @@ using ::testing::StartsWith;
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
void cleanup_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
void cleanup_lammps(LAMMPS *&lmp, const TestConfig &cfg)
|
||||
{
|
||||
platform::unlink(cfg.basename + ".restart");
|
||||
delete lmp;
|
||||
lmp = nullptr;
|
||||
}
|
||||
|
||||
LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool use_respa)
|
||||
|
||||
@ -53,12 +53,13 @@ using ::testing::StartsWith;
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
void cleanup_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
void cleanup_lammps(LAMMPS *&lmp, const TestConfig &cfg)
|
||||
{
|
||||
platform::unlink(cfg.basename + ".restart");
|
||||
platform::unlink(cfg.basename + ".data");
|
||||
platform::unlink(cfg.basename + "-coeffs.in");
|
||||
delete lmp;
|
||||
lmp = nullptr;
|
||||
}
|
||||
|
||||
LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton)
|
||||
|
||||
@ -54,12 +54,13 @@ using ::testing::StartsWith;
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
void cleanup_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
void cleanup_lammps(LAMMPS *&lmp, const TestConfig &cfg)
|
||||
{
|
||||
platform::unlink(cfg.basename + ".restart");
|
||||
platform::unlink(cfg.basename + ".data");
|
||||
platform::unlink(cfg.basename + "-coeffs.in");
|
||||
delete lmp;
|
||||
lmp = nullptr;
|
||||
}
|
||||
|
||||
LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton)
|
||||
|
||||
Reference in New Issue
Block a user