diff --git a/xs/src/TriangleMesh.cpp b/xs/src/TriangleMesh.cpp index 134c529456..bc653d8ec5 100644 --- a/xs/src/TriangleMesh.cpp +++ b/xs/src/TriangleMesh.cpp @@ -27,19 +27,19 @@ TriangleMesh::TriangleMesh(const TriangleMesh &other) this->stl.heads = NULL; this->stl.tail = NULL; if (other.stl.facet_start != NULL) { - this->stl.facet_start = new stl_facet[other.stl.stats.number_of_facets]; + this->stl.facet_start = (stl_facet*)calloc(other.stl.stats.number_of_facets, sizeof(stl_facet)); std::copy(other.stl.facet_start, other.stl.facet_start + other.stl.stats.number_of_facets, this->stl.facet_start); } if (other.stl.neighbors_start != NULL) { - this->stl.neighbors_start = new stl_neighbors[other.stl.stats.number_of_facets]; + this->stl.neighbors_start = (stl_neighbors*)calloc(other.stl.stats.number_of_facets, sizeof(stl_neighbors)); std::copy(other.stl.neighbors_start, other.stl.neighbors_start + other.stl.stats.number_of_facets, this->stl.neighbors_start); } if (other.stl.v_indices != NULL) { - this->stl.v_indices = new v_indices_struct[other.stl.stats.number_of_facets]; + this->stl.v_indices = (v_indices_struct*)calloc(other.stl.stats.number_of_facets, sizeof(v_indices_struct)); std::copy(other.stl.v_indices, other.stl.v_indices + other.stl.stats.number_of_facets, this->stl.v_indices); } if (other.stl.v_shared != NULL) { - this->stl.v_shared = new stl_vertex[other.stl.stats.shared_vertices]; + this->stl.v_shared = (stl_vertex*)calloc(other.stl.stats.shared_vertices, sizeof(stl_vertex)); std::copy(other.stl.v_shared, other.stl.v_shared + other.stl.stats.shared_vertices, this->stl.v_shared); } }