fix memory leak in test

This commit is contained in:
Axel Kohlmeyer
2025-04-05 00:26:20 -04:00
parent b9228a854e
commit e0847f2195

View File

@ -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();