mirror of https://gitee.com/bigwinds/arangodb
fixed undefined behavior
This commit is contained in:
parent
841790e524
commit
8d17d10ebb
|
@ -151,9 +151,10 @@ void QueryCacheDatabaseEntry::store(uint64_t hash,
|
||||||
// remove previous entry
|
// remove previous entry
|
||||||
auto it = _entriesByHash.find(hash);
|
auto it = _entriesByHash.find(hash);
|
||||||
TRI_ASSERT(it != _entriesByHash.end());
|
TRI_ASSERT(it != _entriesByHash.end());
|
||||||
unlink((*it).second);
|
auto previous = (*it).second;
|
||||||
|
unlink(previous);
|
||||||
_entriesByHash.erase(it);
|
_entriesByHash.erase(it);
|
||||||
tryDelete((*it).second);
|
tryDelete(previous);
|
||||||
|
|
||||||
// and insert again
|
// and insert again
|
||||||
_entriesByHash.emplace(hash, entry);
|
_entriesByHash.emplace(hash, entry);
|
||||||
|
@ -186,9 +187,10 @@ void QueryCacheDatabaseEntry::store(uint64_t hash,
|
||||||
// finally remove entry itself from hash table
|
// finally remove entry itself from hash table
|
||||||
auto it = _entriesByHash.find(hash);
|
auto it = _entriesByHash.find(hash);
|
||||||
TRI_ASSERT(it != _entriesByHash.end());
|
TRI_ASSERT(it != _entriesByHash.end());
|
||||||
|
auto previous = (*it).second;
|
||||||
_entriesByHash.erase(it);
|
_entriesByHash.erase(it);
|
||||||
unlink((*it).second);
|
unlink(previous);
|
||||||
tryDelete((*it).second);
|
tryDelete(previous);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,6 +402,8 @@ QueryCacheResultEntry* QueryCache::store(
|
||||||
TRI_vocbase_t* vocbase, uint64_t hash, char const* queryString,
|
TRI_vocbase_t* vocbase, uint64_t hash, char const* queryString,
|
||||||
size_t queryStringLength, std::shared_ptr<VPackBuilder> result,
|
size_t queryStringLength, std::shared_ptr<VPackBuilder> result,
|
||||||
std::vector<std::string> const& collections) {
|
std::vector<std::string> const& collections) {
|
||||||
|
|
||||||
|
|
||||||
if (!result->slice().isArray()) {
|
if (!result->slice().isArray()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue