fix memory leak in test

This commit is contained in:
Axel Kohlmeyer
2025-04-05 00:26:20 -04:00
parent 12364742b1
commit c19fefb782

View File

@ -427,10 +427,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) {
@ -739,6 +739,7 @@ TEST(FixTimestep, omp)
if (!verbose) ::testing::internal::CaptureStdout();
cleanup_lammps(lmp, test_config);
delete lmp;
if (!verbose) ::testing::internal::GetCapturedStdout();
::testing::internal::CaptureStdout();