From 6346116eb81bf7a843af793ee6781fd1f2440744 Mon Sep 17 00:00:00 2001 From: David Wells Date: Fri, 2 Oct 2015 16:47:29 -0400 Subject: [PATCH] Use a unique_ptr to avoid a memory leak. --- source/fe/fe_q_bubbles.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/fe/fe_q_bubbles.cc b/source/fe/fe_q_bubbles.cc index 7616ac57a3..1c00f08d99 100644 --- a/source/fe/fe_q_bubbles.cc +++ b/source/fe/fe_q_bubbles.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -54,26 +55,26 @@ namespace FE_Q_Bubbles_Helper // Initialize quadrature formula on fine cells MappingQ1 mapping; - Quadrature *q_fine; + std_cxx11::unique_ptr > q_fine; Quadrature<1> q_dummy(std::vector >(1), std::vector (1,1.)); switch (dim) { case 1: if (spacedim==1) - q_fine = new QGauss (degree+1); + q_fine.reset(new QGauss (degree+1)); else if (spacedim==2) - q_fine = new QAnisotropic(QGauss<1>(degree+1), q_dummy); + q_fine.reset(new QAnisotropic(QGauss<1>(degree+1), q_dummy)); else - q_fine = new QAnisotropic(QGauss<1>(degree+1), q_dummy, q_dummy); + q_fine.reset(new QAnisotropic(QGauss<1>(degree+1), q_dummy, q_dummy)); break; case 2: if (spacedim==2) - q_fine = new QGauss (degree+1); + q_fine.reset(new QGauss (degree+1)); else - q_fine = new QAnisotropic(QGauss<1>(degree+1), QGauss<1>(degree+1), q_dummy); + q_fine.reset(new QAnisotropic(QGauss<1>(degree+1), QGauss<1>(degree+1), q_dummy)); break; case 3: - q_fine = new QGauss (degree+1); + q_fine.reset(new QGauss (degree+1)); break; default: AssertThrow(false, ExcInternalError()); -- 2.39.5