瀏覽代碼

Leaking memory in tetgen

mesh_to_tetgenio is initializing the facetmarkerlist, and inserting
values into it. We were also doing the same thing in tetrahedralize.cpp.
I've removed this initialization, and just overwrote the facet markers.
Included a comment inline as well.


Former-commit-id: bf4ab3c81b7e763d9c6c489b42255217301993e1
Nathan Clement 9 年之前
父節點
當前提交
0d358c6d6b
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      include/igl/copyleft/tetgen/tetrahedralize.cpp

+ 2 - 1
include/igl/copyleft/tetgen/tetrahedralize.cpp

@@ -178,7 +178,8 @@ IGL_INLINE int igl::copyleft::tetgen::tetrahedralize(
 	for (int i = 0; i < VM.size(); ++i) {
 	for (int i = 0; i < VM.size(); ++i) {
 		in.pointmarkerlist[i] = VM[i];
 		in.pointmarkerlist[i] = VM[i];
 	}
 	}
-	in.facetmarkerlist = new int[FM.size()];
+  // These have already been created in mesh_to_tetgenio.
+  // Reset them here.
 	for (int i = 0; i < FM.size(); ++i) {
 	for (int i = 0; i < FM.size(); ++i) {
 		in.facetmarkerlist[i] = FM[i];
 		in.facetmarkerlist[i] = FM[i];
 	}
 	}