From 12ab3d7cce3ef437edb81006bb1d9549be507b3d Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Tue, 26 Feb 2013 13:11:39 +0000 Subject: [PATCH] fix memory leaks --- ng/ngpkg.cpp | 4 +++- nglib/nglib.cpp | 6 +++++- tutorials/cubeandring.geo | 1 - 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ng/ngpkg.cpp b/ng/ngpkg.cpp index baaa0dd6..67cd0988 100644 --- a/ng/ngpkg.cpp +++ b/ng/ngpkg.cpp @@ -287,11 +287,13 @@ namespace netgen PrintMessage (1, "Save mesh to file ", filename, ".... Please Wait!"); ofstream outfile(filename.c_str()); + //ogzstream outfile( (filename+".gz").c_str()); mesh -> Save (outfile); outfile << endl << endl << "endmesh" << endl << endl; - ng_geometry -> SaveToMeshFile (outfile); + if (ng_geometry) + ng_geometry -> SaveToMeshFile (outfile); /* CSGeometry * geometry = dynamic_cast (ng_geometry); if (geometry && geometry->GetNSurf()) geometry->SaveSurfaces(outfile); diff --git a/nglib/nglib.cpp b/nglib/nglib.cpp index 1830a38a..25b168f0 100644 --- a/nglib/nglib.cpp +++ b/nglib/nglib.cpp @@ -17,6 +17,7 @@ #include #include #include +#include <../visualization/soldata.hpp> #ifdef OCCGEOMETRY #include @@ -1226,7 +1227,10 @@ namespace netgen void Ng_Redraw () { ; } void Ng_ClearSolutionData () { ; } -void Ng_SetSolutionData (Ng_SolutionData * soldata) { ; } +void Ng_SetSolutionData (Ng_SolutionData * soldata) +{ + delete soldata->solclass; +} void Ng_InitSolutionData (Ng_SolutionData * soldata) { ; } diff --git a/tutorials/cubeandring.geo b/tutorials/cubeandring.geo index 11f4f544..7cd2de58 100644 --- a/tutorials/cubeandring.geo +++ b/tutorials/cubeandring.geo @@ -53,4 +53,3 @@ solid brickandring = mytorus or bbb; tlo brickandring; -point (-3.8, 3.8, 0.1); \ No newline at end of file