Browse Source

fix memory leak in rare case

Samuel Thibault 8 years ago
parent
commit
f599bc3c4e
1 changed files with 9 additions and 0 deletions
  1. 9 0
      src/sched_policies/component_worker.c

+ 9 - 0
src/sched_policies/component_worker.c

@@ -217,6 +217,15 @@ static void _starpu_worker_task_list_destroy(struct _starpu_worker_task_list * l
 {
 {
 	if(l)
 	if(l)
 	{
 	{
+		/* There can be empty task grids, when we picked the last task after the front task grid */
+		struct _starpu_task_grid *t = l->first, *nextt;
+
+		while(t) {
+			STARPU_ASSERT(!t->task);
+			nextt = t->up;
+			_starpu_task_grid_destroy(t);
+			t = nextt;
+		}
 		STARPU_PTHREAD_MUTEX_DESTROY(&l->mutex);
 		STARPU_PTHREAD_MUTEX_DESTROY(&l->mutex);
 		free(l);
 		free(l);
 	}
 	}