[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:16 PDT 2020


aprantl created this revision.
aprantl added reviewers: JDevlieghere, friss.
JDevlieghere accepted this revision.
This revision is now accepted and ready to land.

I'm sorry, I just introduced this in https://reviews.llvm.org/D80595. Thanks Jonas for noticing!


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.266673.patch
Type: text/x-patch
Size: 563 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200527/ba118d07/attachment.bin>


More information about the lldb-commits mailing list