kernel/thread: Free death entries if they aren't used.
Otherwise they will be leaked. I added a dprintf() in this codepath, it happened a small number of times on boot and when running a compile job.
This commit is contained in:
@@ -2268,12 +2268,17 @@ thread_exit(void)
|
|||||||
} else {
|
} else {
|
||||||
// The thread is not the main thread. We store a thread death entry
|
// The thread is not the main thread. We store a thread death entry
|
||||||
// for it, unless someone is already waiting for it.
|
// for it, unless someone is already waiting for it.
|
||||||
if (threadDeathEntry != NULL && thread->exit.waiters.IsEmpty()) {
|
if (threadDeathEntry != NULL) {
|
||||||
|
if (thread->exit.waiters.IsEmpty()) {
|
||||||
threadDeathEntry->thread = thread->id;
|
threadDeathEntry->thread = thread->id;
|
||||||
threadDeathEntry->status = thread->exit.status;
|
threadDeathEntry->status = thread->exit.status;
|
||||||
|
|
||||||
// add entry to dead thread list
|
// add entry to dead thread list
|
||||||
team->dead_threads.Add(threadDeathEntry);
|
team->dead_threads.Add(threadDeathEntry);
|
||||||
|
} else {
|
||||||
|
deferred_free(threadDeathEntry);
|
||||||
|
threadDeathEntry = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
threadCreationLocker.Unlock();
|
threadCreationLocker.Unlock();
|
||||||
|
|||||||
Reference in New Issue
Block a user