Fix use-after-free found by ASAN

DenseMap::lookup returns copy of the value in the map. Returning the
address of the temporary return value will cause use-after-free.

llvm-svn: 295675
This commit is contained in:
Steven Wu 2017-02-20 18:33:40 +00:00
parent 51c0128310
commit abfea28867
1 changed files with 1 additions and 1 deletions

View File

@ -111,7 +111,7 @@ public:
unsigned int getNumCounters() const { return RegisteredCounters.size(); }
// Return the name and description of the counter with the given ID.
std::pair<StringRef, StringRef> getCounterInfo(unsigned ID) const {
std::pair<std::string, std::string> getCounterInfo(unsigned ID) const {
return std::make_pair(RegisteredCounters[ID], CounterDesc.lookup(ID));
}