Merge pull request #4211 from sfc-gh-anoyes/anoyes/fix-memory-error

Fix heap use after free
This commit is contained in:
Xiaoge Su 2021-01-19 13:12:05 -08:00 committed by GitHub
commit 297b9cc7dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -316,12 +316,12 @@ public:
class CurrentRunningFetchKeys {
std::unordered_map<UID, double> startTimeMap;
std::unordered_map<UID, KeyRangeRef> keyRangeMap;
std::unordered_map<UID, KeyRange> keyRangeMap;
static const StringRef emptyString;
static const KeyRangeRef emptyKeyRange;
public:
void recordStart(const UID id, const KeyRange keyRange) {
void recordStart(const UID id, const KeyRange& keyRange) {
startTimeMap[id] = now();
keyRangeMap[id] = keyRange;
}
@ -331,7 +331,7 @@ public:
keyRangeMap.erase(id);
}
std::pair<double, KeyRangeRef> longestTime() const {
std::pair<double, KeyRange> longestTime() const {
if (numRunning() == 0) {
return {-1, emptyKeyRange};
}