From 12b7ff65b949040f546260f7e6946c742e8bd626 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 10 Nov 2016 09:29:49 -0700 Subject: [PATCH] Fix a variety of memory leaks in the testsuite. --- tests/bits/step-14.cc | 14 ++++++++------ tests/lac/constraints_block_01.cc | 6 +++--- tests/multigrid/step-39-03.cc | 2 ++ .../parameter_handler_double_02.cc | 3 ++- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/bits/step-14.cc b/tests/bits/step-14.cc index c24272fc0f..ba43cc5637 100644 --- a/tests/bits/step-14.cc +++ b/tests/bits/step-14.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2005 - 2015 by the deal.II authors +// Copyright (C) 2005 - 2016 by the deal.II authors // // This file is part of the deal.II library. // @@ -2124,6 +2124,11 @@ int main () deallog.threshold_double(1.e-10); const unsigned int dim = 2; + + Data::SetUp,dim> setup; + const Point evaluation_point (0.75, 0.75); + DualFunctional::PointValueEvaluation eval(evaluation_point); + Framework::ProblemDescription descriptor; descriptor.refinement_criterion @@ -2132,11 +2137,8 @@ int main () descriptor.primal_fe_degree = 1; descriptor.dual_fe_degree = 2; - descriptor.data = new Data::SetUp,dim> (); - - const Point evaluation_point (0.75, 0.75); - descriptor.dual_functional - = new DualFunctional::PointValueEvaluation (evaluation_point); + descriptor.data = &setup; + descriptor.dual_functional = &eval; Evaluation::PointValueEvaluation postprocessor1 (evaluation_point); diff --git a/tests/lac/constraints_block_01.cc b/tests/lac/constraints_block_01.cc index 788eba7849..2d3891b39e 100644 --- a/tests/lac/constraints_block_01.cc +++ b/tests/lac/constraints_block_01.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2012 - 2015 by the deal.II authors +// Copyright (C) 2012 - 2016 by the deal.II authors // // This file is part of the deal.II library. // @@ -114,8 +114,8 @@ int main () std::string fluid_fe_name = "FESystem[FE_Nothing()^2-FE_Nothing()^2-FE_Q(2)^2-FE_Q(1)-FE_Q(2)^2]"; hp::FECollection fe_collection; - FiniteElement *solid_fe = FETools::get_fe_by_name(solid_fe_name); - FiniteElement *fluid_fe = FETools::get_fe_by_name(fluid_fe_name); + std_cxx11::unique_ptr > solid_fe (FETools::get_fe_by_name(solid_fe_name)); + std_cxx11::unique_ptr > fluid_fe (FETools::get_fe_by_name(fluid_fe_name)); deallog << "Solid FE Space: " << solid_fe->get_name() << std::endl; deallog << "Fluid/Mesh FE Space: " << fluid_fe->get_name() << std::endl; diff --git a/tests/multigrid/step-39-03.cc b/tests/multigrid/step-39-03.cc index f082fb49df..64428156b4 100644 --- a/tests/multigrid/step-39-03.cc +++ b/tests/multigrid/step-39-03.cc @@ -675,6 +675,8 @@ namespace Step39 data_out.build_patches (); data_out.write_gnuplot(gnuplot_output); + + delete[] fn; } template diff --git a/tests/parameter_handler/parameter_handler_double_02.cc b/tests/parameter_handler/parameter_handler_double_02.cc index a42fedba5b..1b60e2b141 100644 --- a/tests/parameter_handler/parameter_handler_double_02.cc +++ b/tests/parameter_handler/parameter_handler_double_02.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2003 - 2015 by the deal.II authors +// Copyright (C) 2003 - 2016 by the deal.II authors // // This file is part of the deal.II library. // @@ -33,6 +33,7 @@ void test(const std::string &desc) return; } deallog << c->description() << std::endl; + delete c; } -- 2.39.5