kern: fix reference leak in KThread::GetThreadFromId callers

This commit is contained in:
Michael Scire authored and SciresM committed 2020-08-18 15:17:40 -07:00
1 parent f77a4fbf98
commit e5d30217d3
2 files changed
+15 -12

No files matched your search

@@ -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();