forgot to destroy object

This commit is contained in:
Niels 2015-02-15 22:58:35 +01:00
parent 568d75954e
commit b387761e12
2 changed files with 5 additions and 3 deletions

View file

@ -431,7 +431,7 @@ class basic_json
} }
case (value_t::string): case (value_t::string):
{ {
// m_value.string = new string_t(*other.m_value.string); // m_value.string = new string_t(*other.m_value.string);
Allocator<string_t> alloc; Allocator<string_t> alloc;
m_value.string = alloc.allocate(1); m_value.string = alloc.allocate(1);
alloc.construct(m_value.string, *other.m_value.string); alloc.construct(m_value.string, *other.m_value.string);
@ -500,11 +500,12 @@ class basic_json
case (value_t::string): case (value_t::string):
{ {
Allocator<string_t> alloc; Allocator<string_t> alloc;
alloc.destroy(m_value.string);
alloc.deallocate(m_value.string, 1); alloc.deallocate(m_value.string, 1);
m_value.string = nullptr; m_value.string = nullptr;
// delete m_value.string; // delete m_value.string;
// m_value.string = nullptr; // m_value.string = nullptr;
break; break;
} }

View file

@ -500,6 +500,7 @@ class basic_json
case (value_t::string): case (value_t::string):
{ {
Allocator<string_t> alloc; Allocator<string_t> alloc;
alloc.destroy(m_value.string);
alloc.deallocate(m_value.string, 1); alloc.deallocate(m_value.string, 1);
m_value.string = nullptr; m_value.string = nullptr;