From 7bb3698043a70026e9578830f1209b237fb65008 Mon Sep 17 00:00:00 2001 From: Michael Neunteufel Date: Mon, 6 May 2019 11:01:54 +0200 Subject: [PATCH] avoid memory leak and cleanup --- libsrc/interface/readuser.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libsrc/interface/readuser.cpp b/libsrc/interface/readuser.cpp index 9273c642..9b9c0a2b 100644 --- a/libsrc/interface/readuser.cpp +++ b/libsrc/interface/readuser.cpp @@ -99,7 +99,7 @@ namespace netgen // map from unv element nr to our element number + an index if it is vol (0), bnd(1), ... std::map> element_map; - Array tmp_segments; + Array tmp_segments; while (in.good()) { in >> reco; @@ -258,9 +258,8 @@ namespace netgen ed.SetSurfNr(0,bcpr);//? ednr = mesh.AddEdgeDescriptor(ed); mesh.SetCD2Name(bcpr, name); - string * bcname = new string(name); auto nr = mesh.AddSegment(tmp_segments[get<0>(element_map[index])-1]); - mesh.LineSegment(nr+1).SetBCName(bcname); + mesh.LineSegment(nr+1).SetBCName(mesh.GetCD2NamePtr(mesh.GetNCD2Names())); mesh.LineSegment(nr+1).edgenr = ednr+1; break; } @@ -283,10 +282,9 @@ namespace netgen break; case 2: { - if (i==0) - continue; auto nr = mesh.AddSegment(tmp_segments[get<0>(element_map[index])-1]); mesh.LineSegment(nr+1).edgenr = ednr+1; + mesh.LineSegment(nr+1).SetBCName(mesh.GetCD2NamePtr(mesh.GetNCD2Names())); } break; default: