소스 검색

Fix KScopedAutoObject object leak when SendSyncRequest

Feng Chen 4 년 전
부모
커밋
7cd43b139a
1개의 변경된 파일8개의 추가작업 그리고 6개의 파일을 삭제
  1. 8 6
      src/core/hle/kernel/svc.cpp

+ 8 - 6
src/core/hle/kernel/svc.cpp

@@ -320,17 +320,19 @@ static ResultCode SendSyncRequest(Core::System& system, Handle handle) {
 
     auto& kernel = system.Kernel();
 
-    KScopedAutoObject session =
-        kernel.CurrentProcess()->GetHandleTable().GetObject<KClientSession>(handle);
-    R_UNLESS(session.IsNotNull(), ResultInvalidHandle);
-    LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName());
-
     auto thread = kernel.CurrentScheduler()->GetCurrentThread();
     {
         KScopedSchedulerLock lock(kernel);
         thread->SetState(ThreadState::Waiting);
         thread->SetWaitReasonForDebugging(ThreadWaitReasonForDebugging::IPC);
-        session->SendSyncRequest(thread, system.Memory(), system.CoreTiming());
+
+        {
+            KScopedAutoObject session =
+                kernel.CurrentProcess()->GetHandleTable().GetObject<KClientSession>(handle);
+            R_UNLESS(session.IsNotNull(), ResultInvalidHandle);
+            LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName());
+            session->SendSyncRequest(thread, system.Memory(), system.CoreTiming());
+        }
     }
 
     KSynchronizationObject* dummy{};