[Lldb-commits] [lldb] fc8911a - [lldb][windows] fix late null check (#200822)

via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 1 07:24:48 PDT 2026


Author: Charles Zablit
Date: 2026-06-01T15:24:42+01:00
New Revision: fc8911a78e3618adbf422d7856ed0cb4115eada1

URL: https://github.com/llvm/llvm-project/commit/fc8911a78e3618adbf422d7856ed0cb4115eada1
DIFF: https://github.com/llvm/llvm-project/commit/fc8911a78e3618adbf422d7856ed0cb4115eada1.diff

LOG: [lldb][windows] fix late null check (#200822)

`process_sp` should be null checked before calling the
`HijackProcessEvents` method. This patch also removes 2 unused
variables.

Added: 
    

Modified: 
    lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index eecbe53d46c24..94e4dd0f40bf5 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -513,13 +513,13 @@ ProcessSP PlatformWindows::DebugProcess(ProcessLaunchInfo &launch_info,
   ProcessSP process_sp =
       target.CreateProcess(launch_info.GetListener(),
                            launch_info.GetProcessPluginName(), nullptr, false);
+  if (!process_sp)
+    return nullptr;
 
   process_sp->HijackProcessEvents(launch_info.GetHijackListener());
 
   // We need to launch and attach to the process.
   launch_info.GetFlags().Set(eLaunchFlagDebug);
-  if (!process_sp)
-    return nullptr;
   error = process_sp->Launch(launch_info);
 #ifdef _WIN32
   if (error.Success()) {
@@ -551,9 +551,6 @@ lldb::ProcessSP PlatformWindows::Attach(ProcessAttachInfo &attach_info,
 
   if (target == nullptr) {
     TargetSP new_target_sp;
-    FileSpec emptyFileSpec;
-    ArchSpec emptyArchSpec;
-
     error = debugger.GetTargetList().CreateTarget(
         debugger, "", "", eLoadDependentsNo, nullptr, new_target_sp);
     target = new_target_sp.get();


        


More information about the lldb-commits mailing list