浏览代码

fix leaks

Samuel Thibault 9 年之前
父节点
当前提交
9bdd1110d5
共有 2 个文件被更改,包括 9 次插入3 次删除
  1. 4 1
      src/sched_policies/component_work_stealing.c
  2. 5 2
      tests/errorcheck/workers_cpuid.c

+ 4 - 1
src/sched_policies/component_work_stealing.c

@@ -327,7 +327,10 @@ void _ws_remove_child(struct starpu_sched_component * component, struct starpu_s
 
 void _work_stealing_component_deinit_data(struct starpu_sched_component * component)
 {
-	free(component->data);
+	struct _starpu_work_stealing_data * wsd = component->data;
+	free(wsd->fifos);
+	free(wsd->mutexes);
+	free(wsd);
 }
 
 int starpu_sched_component_is_work_stealing(struct starpu_sched_component * component)

+ 5 - 2
tests/errorcheck/workers_cpuid.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2012, 2015  Université de Bordeaux
+ * Copyright (C) 2010-2012, 2015-2016  Université de Bordeaux
  * Copyright (C) 2010, 2011, 2012, 2013  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -85,10 +85,13 @@ static char *array_to_str(long *array, int n)
 static int test_combination(long *combination, unsigned n)
 {
 	int type, ret, device_workers;
+	char *str;
 
 	copy_cpuid_array(workers_cpuid, combination, n);
 
-	setenv("STARPU_WORKERS_CPUID", array_to_str(workers_cpuid, n), 1);
+	str = array_to_str(workers_cpuid, n);
+	setenv("STARPU_WORKERS_CPUID", str, 1);
+	free(str);
 
 	ret = starpu_init(NULL);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;