From 683083e5ae080ff24c8ac09e894705e289715e95 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Thu, 29 Aug 2024 10:06:03 +0200 Subject: [PATCH] [EDF30834] : Fix memory leak --- src/ShapeRecogn/ShapeRecognMeshBuilder.cxx | 4 ++-- src/ShapeRecogn/ShapeRecognMeshBuilder.hxx | 2 +- src/ShapeRecogn/Test/ConeTest.cxx | 1 + src/ShapeRecogn/Test/CylinderTest.cxx | 1 + src/ShapeRecogn/Test/PlaneTest.cxx | 1 + src/ShapeRecogn/Test/SphereTest.cxx | 1 + src/ShapeRecogn/Test/TorusTest.cxx | 1 + 7 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ShapeRecogn/ShapeRecognMeshBuilder.cxx b/src/ShapeRecogn/ShapeRecognMeshBuilder.cxx index f0a2b0581..9118fa758 100644 --- a/src/ShapeRecogn/ShapeRecognMeshBuilder.cxx +++ b/src/ShapeRecogn/ShapeRecognMeshBuilder.cxx @@ -26,7 +26,7 @@ ShapeRecognMeshBuilder::~ShapeRecognMeshBuilder() mesh->decrRef(); } -ShapeRecognMesh *ShapeRecognMeshBuilder::recognize() +MCAuto ShapeRecognMeshBuilder::recognize() { mesh->incrRef(); NodesBuilder nodesBuilder(mesh); @@ -48,7 +48,7 @@ ShapeRecognMesh *ShapeRecognMeshBuilder::recognize() recognMesh->center = buildCenter(); recognMesh->axis = buildAxis(); recognMesh->apex = buildApex(); - return recognMesh.retn(); + return recognMesh; } const Nodes *ShapeRecognMeshBuilder::getNodes() const diff --git a/src/ShapeRecogn/ShapeRecognMeshBuilder.hxx b/src/ShapeRecogn/ShapeRecognMeshBuilder.hxx index eee7c1507..6ac42743c 100644 --- a/src/ShapeRecogn/ShapeRecognMeshBuilder.hxx +++ b/src/ShapeRecogn/ShapeRecognMeshBuilder.hxx @@ -40,7 +40,7 @@ namespace MEDCoupling const Nodes *getNodes() const; const Areas *getAreas() const; - ShapeRecognMesh *recognize(); + MCAuto recognize(); private: // Node properties diff --git a/src/ShapeRecogn/Test/ConeTest.cxx b/src/ShapeRecogn/Test/ConeTest.cxx index d25f4a792..b43616c4f 100644 --- a/src/ShapeRecogn/Test/ConeTest.cxx +++ b/src/ShapeRecogn/Test/ConeTest.cxx @@ -1,6 +1,7 @@ #include "ConeTest.hxx" #include "ShapeRecognMeshBuilder.hxx" +#include "ShapeRecognMesh.hxx" #include "Areas.hxx" #include "MathOps.hxx" #include "TestInterpKernelUtils.hxx" // getResourceFile() diff --git a/src/ShapeRecogn/Test/CylinderTest.cxx b/src/ShapeRecogn/Test/CylinderTest.cxx index 47f6ac3d3..abe69828a 100644 --- a/src/ShapeRecogn/Test/CylinderTest.cxx +++ b/src/ShapeRecogn/Test/CylinderTest.cxx @@ -1,6 +1,7 @@ #include "CylinderTest.hxx" #include "ShapeRecognMeshBuilder.hxx" +#include "ShapeRecognMesh.hxx" #include "Areas.hxx" #include "MathOps.hxx" #include "TestInterpKernelUtils.hxx" // getResourceFile() diff --git a/src/ShapeRecogn/Test/PlaneTest.cxx b/src/ShapeRecogn/Test/PlaneTest.cxx index 6f47f161c..ea1153252 100644 --- a/src/ShapeRecogn/Test/PlaneTest.cxx +++ b/src/ShapeRecogn/Test/PlaneTest.cxx @@ -1,6 +1,7 @@ #include "PlaneTest.hxx" #include "ShapeRecognMeshBuilder.hxx" +#include "ShapeRecognMesh.hxx" #include "Areas.hxx" #include "MathOps.hxx" #include "TestInterpKernelUtils.hxx" // getResourceFile() diff --git a/src/ShapeRecogn/Test/SphereTest.cxx b/src/ShapeRecogn/Test/SphereTest.cxx index 4d7f64ecb..f0b824886 100644 --- a/src/ShapeRecogn/Test/SphereTest.cxx +++ b/src/ShapeRecogn/Test/SphereTest.cxx @@ -1,6 +1,7 @@ #include "SphereTest.hxx" #include "ShapeRecognMeshBuilder.hxx" +#include "ShapeRecognMesh.hxx" #include "Areas.hxx" #include "MathOps.hxx" #include "TestInterpKernelUtils.hxx" // getResourceFile() diff --git a/src/ShapeRecogn/Test/TorusTest.cxx b/src/ShapeRecogn/Test/TorusTest.cxx index 6e24d10ee..9b55f23d0 100644 --- a/src/ShapeRecogn/Test/TorusTest.cxx +++ b/src/ShapeRecogn/Test/TorusTest.cxx @@ -4,6 +4,7 @@ #include "Areas.hxx" #include "MathOps.hxx" #include "TestInterpKernelUtils.hxx" // getResourceFile() +#include "ShapeRecognMesh.hxx" using namespace MEDCoupling; -- 2.39.2