diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2013-11-11 18:07:38 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2013-11-11 18:07:38 +0400 |
commit | 3ac94bd6d8de507a3ebe5261cad33a0f66de46a2 (patch) | |
tree | 759e07d5c6bbc0cfd342914a8ff5fde2880d8604 | |
parent | e024b08762a7fac426555f88ca5d0bb645bad7fd (diff) |
Fix a valgrind warning about mismatched free()
-rw-r--r-- | xs/src/TriangleMesh.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/xs/src/TriangleMesh.cpp b/xs/src/TriangleMesh.cpp index 134c52945..bc653d8ec 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); } } |