Browse Source
Merge pull request #6382 from lioncash/null
k_thread: Move dereference after null check in Initialize()
pull/15/merge
bunnei
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
5 additions and
5 deletions
-
src/core/hle/kernel/k_thread.cpp
|
|
|
@ -168,13 +168,13 @@ ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_s |
|
|
|
std::memset(static_cast<void*>(std::addressof(GetStackParameters())), 0, |
|
|
|
sizeof(StackParameters)); |
|
|
|
|
|
|
|
// Setup the TLS, if needed.
|
|
|
|
if (type == ThreadType::User) { |
|
|
|
tls_address = owner->CreateTLSRegion(); |
|
|
|
} |
|
|
|
|
|
|
|
// Set parent, if relevant.
|
|
|
|
if (owner != nullptr) { |
|
|
|
// Setup the TLS, if needed.
|
|
|
|
if (type == ThreadType::User) { |
|
|
|
tls_address = owner->CreateTLSRegion(); |
|
|
|
} |
|
|
|
|
|
|
|
parent = owner; |
|
|
|
parent->Open(); |
|
|
|
parent->IncrementThreadCount(); |
|
|
|
|