Fix use-after-free in function index merging code.
authorTeresa Johnson <tejohnson@google.com>
Mon, 2 Nov 2015 20:43:33 +0000 (20:43 +0000)
committerTeresa Johnson <tejohnson@google.com>
Mon, 2 Nov 2015 20:43:33 +0000 (20:43 +0000)
This was flagged by ASAN when using a test case I will be committing
along with D13515.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251827 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/FunctionInfo.cpp

index 015f1235f6df7552f5bf1110d60a87d078363a83..d26c7a4e9a03be5a37e297e3a9b50025f21bcca5 100644 (file)
@@ -23,7 +23,7 @@ void FunctionInfoIndex::mergeFrom(std::unique_ptr<FunctionInfoIndex> Other,
 
   StringRef ModPath;
   for (auto &OtherFuncInfoLists : *Other) {
-    StringRef FuncName = OtherFuncInfoLists.getKey();
+    std::string FuncName = OtherFuncInfoLists.getKey();
     FunctionInfoList &List = OtherFuncInfoLists.second;
 
     // Assert that the func info list only has one entry, since we shouldn't