diff --git a/unittest/force-styles/test_fix_timestep.cpp b/unittest/force-styles/test_fix_timestep.cpp index b952a3c045..d1bdee3535 100644 --- a/unittest/force-styles/test_fix_timestep.cpp +++ b/unittest/force-styles/test_fix_timestep.cpp @@ -446,10 +446,10 @@ TEST(FixTimestep, plain) !utils::strmatch(ifix->style, "^nve/limit") && !utils::strmatch(ifix->style, "^recenter")) { if (!verbose) ::testing::internal::CaptureStdout(); cleanup_lammps(lmp, test_config); + delete lmp; if (!verbose) ::testing::internal::GetCapturedStdout(); ::testing::internal::CaptureStdout(); - LAMMPS *lmp = nullptr; try { lmp = init_lammps(args, test_config, true); } catch (std::exception &e) { @@ -758,6 +758,7 @@ TEST(FixTimestep, omp) if (!verbose) ::testing::internal::CaptureStdout(); cleanup_lammps(lmp, test_config); + delete lmp; if (!verbose) ::testing::internal::GetCapturedStdout(); ::testing::internal::CaptureStdout();