#3076: Avoid access to already freed memory in JSON code

This commit is contained in:
Günter Obiltschnig
2021-04-11 16:37:16 +02:00
parent 347dc840b5
commit 7e9d10f488
3 changed files with 44 additions and 1 deletions

View File

@@ -443,7 +443,6 @@ inline std::size_t Object::size() const
inline void Object::remove(const std::string& key)
{
_values.erase(key);
if (_preserveInsOrder)
{
KeyList::iterator it = _keys.begin();
@@ -457,6 +456,7 @@ inline void Object::remove(const std::string& key)
}
}
}
_values.erase(key);
_modified = true;
}