浏览代码

examples/worker_collections/worker_tree_example.c: make sure memory is initialised to 0

Nathalie Furmento 10 年之前
父节点
当前提交
a60654374b
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      examples/worker_collections/worker_tree_example.c

+ 2 - 2
examples/worker_collections/worker_tree_example.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  *
  * Copyright (C) 2010-2015  Université de Bordeaux
  * Copyright (C) 2010-2015  Université de Bordeaux
- * Copyright (C) 2010-2014  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010-2015  Centre National de la Recherche Scientifique
  *
  *
  * StarPU is free software; you can redistribute it and/or modify
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
  * it under the terms of the GNU Lesser General Public License as published by
@@ -40,7 +40,7 @@ int main()
 	unsigned ncpus =  starpu_cpu_worker_get_count();
 	unsigned ncpus =  starpu_cpu_worker_get_count();
         starpu_worker_get_ids_by_type(STARPU_CPU_WORKER, procs, ncpus);
         starpu_worker_get_ids_by_type(STARPU_CPU_WORKER, procs, ncpus);
 
 
-	struct starpu_worker_collection *co = (struct starpu_worker_collection*)malloc(sizeof(struct starpu_worker_collection));
+	struct starpu_worker_collection *co = (struct starpu_worker_collection*)calloc(1, sizeof(struct starpu_worker_collection));
 	co->has_next = worker_tree.has_next;
 	co->has_next = worker_tree.has_next;
 	co->get_next = worker_tree.get_next;
 	co->get_next = worker_tree.get_next;
 	co->add = worker_tree.add;
 	co->add = worker_tree.add;