浏览代码

heat: Use an initial zeroed vector instead of heap uninitialized values

Samuel Thibault 5 年之前
父节点
当前提交
1397e8d559
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      examples/heat/heat.c

+ 1 - 1
examples/heat/heat.c

@@ -711,7 +711,7 @@ int main(int argc, char **argv)
 	RefArray = malloc(DIM*sizeof(int));
 	RefArrayBack = malloc(DIM*sizeof(int));
 	Bformer = malloc(DIM*sizeof(float));
-	result = malloc(DIM*sizeof(float));
+	result = calloc(DIM, sizeof(float));
 
 	build_mesh(pmesh);