Skip to content

Commit

Permalink
Merge pull request #14 from elliotgoodrich/master
Browse files Browse the repository at this point in the history
Fix double delete on std::bad_alloc exception
  • Loading branch information
nlohmann committed Jan 6, 2015
2 parents a53c878 + 0773f40 commit 5f05d02
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/json.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit 5f05d02

Please sign in to comment.