From 724ab064d27f15fb6891409964742b8a3a523da3 Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Fri, 17 Apr 2020 11:58:55 +0200
Subject: [PATCH] [MeL/Elements] unique_ptr instead of raw pointer.

---
 MeshLib/Elements/PyramidRule5.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MeshLib/Elements/PyramidRule5.cpp b/MeshLib/Elements/PyramidRule5.cpp
index eea3de3bafd..333f3c4b23f 100644
--- a/MeshLib/Elements/PyramidRule5.cpp
+++ b/MeshLib/Elements/PyramidRule5.cpp
@@ -110,7 +110,8 @@ ElementErrorCode PyramidRule5::validate(const Element* e)
     ElementErrorCode error_code;
     error_code[ElementErrorFlag::ZeroVolume] = e->hasZeroVolume();
 
-    const auto* base(dynamic_cast<const MeshLib::Quad*>(e->getFace(4)));
+    std::unique_ptr<MeshLib::Quad const> const base{
+        dynamic_cast<MeshLib::Quad const*>(e->getFace(4))};
     if (base)
     {
         error_code |= base->validate();
@@ -120,7 +121,6 @@ ElementErrorCode PyramidRule5::validate(const Element* e)
     {
         error_code.set(ElementErrorFlag::NodeOrder);
     }
-    delete base;
 
     return error_code;
 }
-- 
GitLab