From 8a7b4a145bc96120e3b1a734862a6f0bf178663c Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 17 Jul 2020 00:03:01 +0200 Subject: [PATCH] PVS: V773 The exception was thrown without releasing the pointer. A memory leak is possible. --- src/Mod/Part/App/FeaturePartSection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mod/Part/App/FeaturePartSection.cpp b/src/Mod/Part/App/FeaturePartSection.cpp index b50e43481c..da4e47855b 100644 --- a/src/Mod/Part/App/FeaturePartSection.cpp +++ b/src/Mod/Part/App/FeaturePartSection.cpp @@ -55,13 +55,13 @@ BRepAlgoAPI_BooleanOperation* Section::makeOperation(const TopoDS_Shape& base, c return new BRepAlgoAPI_Section(base, tool); #else bool approx = Approximation.getValue(); - BRepAlgoAPI_Section* mkSection = new BRepAlgoAPI_Section(); + std::unique_ptr mkSection(new BRepAlgoAPI_Section()); mkSection->Init1(base); mkSection->Init2(tool); mkSection->Approximation(approx); mkSection->Build(); if (!mkSection->IsDone()) throw Base::RuntimeError("Section failed"); - return mkSection; + return mkSection.release(); #endif }