Sfoglia il codice sorgente

Do not dereference freed memory in starpu_bound_start().

smatch: "error: dereferencing freed memory" (x3)
Cyril Roelandt 13 anni fa
parent
commit
26d460d118
1 ha cambiato i file con 15 aggiunte e 3 eliminazioni
  1. 15 3
      src/profiling/bound.c

+ 15 - 3
src/profiling/bound.c

@@ -142,14 +142,26 @@ void starpu_bound_start(int deps, int prio)
 
 	_STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
 
-	for ( ; tp; tp = tp->next)
+	while (tp != NULL)
+	{
+		struct bound_task_pool *next = tp->next;
 		free(tp);
+		tp = next;
+	}
 
-	for ( ; t; t = t->next)
+	while (t != NULL)
+	{
+		struct bound_task *next = t->next;
 		free(t);
+		t = next;
+	}
 
-	for ( ; td; td = td->next)
+	while (td != NULL)
+	{
+		struct bound_tag_dep *next = td->next;
 		free(td);
+		td = next;
+	}
 }
 
 static int good_job(struct _starpu_job *j)