forked from OSchip/llvm-project
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:
parent
51c0128310
commit
abfea28867
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue