소스 검색

socl/src/command.c: use calloc to set allocated memory to 0

Nathalie Furmento 13 년 전
부모
커밋
fcc7d24f2e
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      socl/src/command.c

+ 2 - 2
socl/src/command.c

@@ -96,7 +96,7 @@ command_ndrange_kernel command_ndrange_kernel_create (
 		const size_t *   global_work_size,
 		const size_t *   local_work_size)
 {
-	command_ndrange_kernel cmd = malloc(sizeof(struct command_ndrange_kernel_t));
+	command_ndrange_kernel cmd = calloc(1, sizeof(struct command_ndrange_kernel_t));
 	command_init(cmd, CL_COMMAND_NDRANGE_KERNEL);
 
 	dupEntity(kernel);
@@ -106,7 +106,7 @@ command_ndrange_kernel command_ndrange_kernel_create (
 	nullOrDup(local_work_size, work_dim*sizeof(size_t));
 
    	/* Codelet */
-   	cmd->codelet = (struct starpu_codelet*)malloc(sizeof(struct starpu_codelet));
+   	cmd->codelet = (struct starpu_codelet*)calloc(1, sizeof(struct starpu_codelet));
 	struct starpu_codelet * codelet = cmd->codelet;
 	codelet->where = STARPU_OPENCL;
 	codelet->power_model = NULL;