[LLDB]Initialize accept_socket with nullptr
authorGeorge Hu <huyubohyb@gmail.com>
Tue, 20 Sep 2022 17:56:16 +0000 (10:56 -0700)
committerGeorge Hu <huyubohyb@gmail.com>
Tue, 20 Sep 2022 19:17:32 +0000 (12:17 -0700)
Fix high impact issue of illegal access of memory.
Initialize accept_socket with nullptr.

Differential Revision: https://reviews.llvm.org/D134293

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

index 745e336..b67cd7e 100644 (file)
@@ -1233,7 +1233,7 @@ GDBRemoteCommunication::ConnectLocally(GDBRemoteCommunication &client,
           listen_socket.Listen("localhost:0", backlog).ToError())
     return error;
 
-  Socket *accept_socket;
+  Socket *accept_socket = nullptr;
   std::future<Status> accept_status = std::async(
       std::launch::async, [&] { return listen_socket.Accept(accept_socket); });