[Lldb-commits] [PATCH] D80666: Fix a use-after-free in GetXcodeSDKPath

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 27 14:43:50 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGa57a67c59b3f: Fix a use-after-free in GetXcodeSDKPath (authored by aprantl).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80666/new/

https://reviews.llvm.org/D80666

Files:
  lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm


Index: lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
===================================================================
--- lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -370,7 +370,6 @@
   auto it = g_sdk_path.find(sdk.GetString());
   if (it != g_sdk_path.end())
     return it->second;
-  std::string path = GetXcodeSDK(sdk);
-  g_sdk_path.insert({sdk.GetString(), path});
-  return path;
+  auto it_new = g_sdk_path.insert({sdk.GetString(), GetXcodeSDK(sdk)});
+  return it_new.first->second;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80666.266677.patch
Type: text/x-patch
Size: 563 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200527/9ba25920/attachment.bin>


More information about the lldb-commits mailing list