Merge pull request #14 from elliotgoodrich/master
Fix double delete on std::bad_alloc exception
This commit is contained in:
commit
5f05d02c6a
1 changed files with 2 additions and 0 deletions
|
@ -1175,6 +1175,7 @@ json::iterator json::find(const char* key)
|
|||
{
|
||||
json::iterator result(this);
|
||||
delete result.oi_;
|
||||
result.oi_ = nullptr;
|
||||
result.oi_ = new object_t::iterator(i);
|
||||
return result;
|
||||
}
|
||||
|
@ -1198,6 +1199,7 @@ json::const_iterator json::find(const char* key) const
|
|||
{
|
||||
json::const_iterator result(this);
|
||||
delete result.oi_;
|
||||
result.oi_ = nullptr;
|
||||
result.oi_ = new object_t::const_iterator(i);
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue