[Lldb-commits] [lldb] a57a67c - Fix a use-after-free in GetXcodeSDKPath
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Wed May 27 14:27:24 PDT 2020
Author: Adrian Prantl
Date: 2020-05-27T14:27:16-07:00
New Revision: a57a67c59b3f7529f4aa30009b214248772b544b
URL: https://github.com/llvm/llvm-project/commit/a57a67c59b3f7529f4aa30009b214248772b544b
DIFF: https://github.com/llvm/llvm-project/commit/a57a67c59b3f7529f4aa30009b214248772b544b.diff
LOG: Fix a use-after-free in GetXcodeSDKPath
Introduced in https://reviews.llvm.org/D80595. Thanks Jonas for noticing!
Differential Revision: https://reviews.llvm.org/D80666
Added:
Modified:
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
Removed:
################################################################################
diff --git a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
index cb6f03465ef7..615f77b2dbcc 100644
--- a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -370,7 +370,6 @@ static void ParseOSVersion(llvm::VersionTuple &version, NSString *Key) {
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;
}
More information about the lldb-commits
mailing list