free the task *after* calling closeCond and closeMutex
authorSimon Marlow <simonmar@microsoft.com>
Thu, 31 Aug 2006 10:36:48 +0000 (10:36 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Thu, 31 Aug 2006 10:36:48 +0000 (10:36 +0000)
rts/Task.c

index 7214725..11307a7 100644 (file)
@@ -76,11 +76,11 @@ stopTaskManager (void)
     ACQUIRE_LOCK(&sched_mutex);
     for (task = task_free_list; task != NULL; task = next) {
         next = task->next;
-        stgFree(task);
 #if defined(THREADED_RTS)
         closeCondition(&task->cond);
         closeMutex(&task->lock);
 #endif
+        stgFree(task);
     }
     task_free_list = NULL;
     RELEASE_LOCK(&sched_mutex);