diff --git a/Applications/FileIO/GMSInterface.cpp b/Applications/FileIO/GMSInterface.cpp index 71cab4a8c2e76a44a53cc72d6ca31fb0b269f2f5..10415bddc5f4e54033f66ce5546cd268127618aa 100644 --- a/Applications/FileIO/GMSInterface.cpp +++ b/Applications/FileIO/GMSInterface.cpp @@ -304,14 +304,7 @@ MeshLib::Mesh* GMSInterface::readGMS3DMMesh(const std::string& filename) if (!opt_pv) { ERR("Could not create PropertyVector for material ids."); - for (auto element : elements) - { - delete element; - } - for (auto node : nodes) - { - delete node; - } + BaseLib::cleanupVectorElements(nodes, elements); return nullptr; } opt_pv->reserve(mat_ids.size()); diff --git a/Applications/FileIO/TetGenInterface.cpp b/Applications/FileIO/TetGenInterface.cpp index 1548468abc65393c67d3d587dc7675cf18301e20..5e9afac09ba7813b7ab1d9225799418794d7e614 100644 --- a/Applications/FileIO/TetGenInterface.cpp +++ b/Applications/FileIO/TetGenInterface.cpp @@ -239,14 +239,7 @@ MeshLib::Mesh* TetGenInterface::readTetGenMesh (std::string const& nodes_fname, std::vector<MeshLib::Element*> elements; std::vector<int> materials; if (!readElementsFromStream (ins_ele, elements, materials, nodes)) { - // remove elements read until now - for (auto & element : elements) { - delete element; - } - // remove nodes - for (auto & node : nodes) { - delete node; - } + BaseLib::cleanupVectorElements(nodes, elements); return nullptr; }