From: David Wells Date: Fri, 2 Oct 2015 20:47:29 +0000 (-0400) Subject: Use a unique_ptr to avoid a memory leak. X-Git-Tag: v8.4.0-rc2~342^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6346116eb81bf7a843af793ee6781fd1f2440744;p=dealii.git Use a unique_ptr to avoid a memory leak. --- 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());