From dc93e5cdfbb111eeb7b4b648353d3cba0d443544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Sun, 25 Dec 2016 18:41:53 +0100 Subject: [PATCH] fix more memory management errors --- src/HalfFacetRep.cpp | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/src/HalfFacetRep.cpp b/src/HalfFacetRep.cpp index 9417532b6..b045f8949 100644 --- a/src/HalfFacetRep.cpp +++ b/src/HalfFacetRep.cpp @@ -613,7 +613,7 @@ namespace moab { //Step 1: Create an index list storing the starting position for each vertex int nv = verts.size(); - int *is_index = new int[nv+1]; + std::vector is_index(nv+1); for (int i =0; i v2hv_map_eid(2*edges.size()); + std::vector v2hv_map_lvid(2*edges.size()); for (Range::iterator eid = edges.begin(); eid != edges.end(); ++eid) { @@ -681,10 +681,6 @@ namespace moab { } } - delete [] is_index; - delete [] v2hv_map_eid; - delete [] v2hv_map_lvid; - return MB_SUCCESS; } @@ -817,7 +813,7 @@ namespace moab { //Step 1: Create an index list storing the starting position for each vertex int nv = _verts.size(); - int *is_index = new int[nv+1]; + std::vector is_index(nv+1); for (int i =0; i v2nv(nepf*nfaces); + std::vector v2he_map_fid(nepf*nfaces); + std::vector v2he_map_leid(nepf*nfaces); for (Range::iterator fid = faces.begin(); fid != faces.end(); ++fid) { @@ -930,13 +926,7 @@ namespace moab { } } - delete [] is_index; - delete [] v2nv; - delete [] v2he_map_fid; - delete [] v2he_map_leid; - return MB_SUCCESS; - } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ErrorCode HalfFacetRep::determine_incident_halfedges( Range &faces) @@ -1632,7 +1622,7 @@ namespace moab { //Step 1: Create an index list storing the starting position for each vertex int nv = _verts.size(); - int *is_index = new int[nv+1]; + std::vector is_index(nv+1); for (int i =0; i v2oe_v1(is_index[nv]); + std::vector v2oe_v2(is_index[nv]); + std::vector v2hf_map_cid(is_index[nv]); + std::vector v2hf_map_lfid(is_index[nv]); for (Range::iterator cid = cells.begin(); cid != cells.end(); ++cid) { @@ -1762,14 +1752,7 @@ namespace moab { } } - delete [] is_index; - delete [] v2oe_v1; - delete [] v2oe_v2; - delete [] v2hf_map_cid; - delete [] v2hf_map_lfid; - return MB_SUCCESS; - } -- GitLab