kern: fix reference leak in KThread::GetThreadFromId callers

This commit is contained in:
Michael Scire 2020-08-15 03:01:43 -07:00 committed by SciresM
parent f77a4fbf98
commit e5d30217d3
2 changed files with 15 additions and 12 deletions

View file

@ -291,8 +291,9 @@ namespace ams::kern::svc {
R_UNLESS(debug.IsNotNull(), svc::ResultInvalidHandle());
/* Get the thread from its id. */
KScopedAutoObject thread = KThread::GetThreadFromId(thread_id);
R_UNLESS(thread.IsNotNull(), svc::ResultInvalidThreadId());
KThread *thread = KThread::GetThreadFromId(thread_id);
R_UNLESS(thread != nullptr, svc::ResultInvalidThreadId());
ON_SCOPE_EXIT { thread->Close(); };
/* Get the process from the debug object. */
KScopedAutoObject process = debug->GetProcess();