소스 검색

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);