Commit 5f05d02c authored by Niels's avatar Niels

Merge pull request #14 from elliotgoodrich/master

Fix double delete on std::bad_alloc exception
parents a53c878c 0773f40a
...@@ -1175,6 +1175,7 @@ json::iterator json::find(const char* key) ...@@ -1175,6 +1175,7 @@ json::iterator json::find(const char* key)
{ {
json::iterator result(this); json::iterator result(this);
delete result.oi_; delete result.oi_;
result.oi_ = nullptr;
result.oi_ = new object_t::iterator(i); result.oi_ = new object_t::iterator(i);
return result; return result;
} }
...@@ -1198,6 +1199,7 @@ json::const_iterator json::find(const char* key) const ...@@ -1198,6 +1199,7 @@ json::const_iterator json::find(const char* key) const
{ {
json::const_iterator result(this); json::const_iterator result(this);
delete result.oi_; delete result.oi_;
result.oi_ = nullptr;
result.oi_ = new object_t::const_iterator(i); result.oi_ = new object_t::const_iterator(i);
return result; return result;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment