diff --git a/MeshLib/Elements/TemplateElement-impl.h b/MeshLib/Elements/TemplateElement-impl.h index dfd271a3f5f37e7a1e69037f4c42ffd633497885..595601ad0a0951fd96b0eddc8c42790e307fe2ca 100644 --- a/MeshLib/Elements/TemplateElement-impl.h +++ b/MeshLib/Elements/TemplateElement-impl.h @@ -18,8 +18,10 @@ TemplateElement<ELEMENT_RULE>::TemplateElement(Node* nodes[n_all_nodes], : Element(id) { std::copy_n(nodes, n_all_nodes, std::begin(_nodes)); + delete[] nodes; this->_neighbors = new Element*[getNumberOfNeighbors()]; - std::fill(this->_neighbors, this->_neighbors + getNumberOfNeighbors(), nullptr); + std::fill(this->_neighbors, this->_neighbors + getNumberOfNeighbors(), + nullptr); this->space_dimension_ = ELEMENT_RULE::dimension; }