diff --git a/src/json.hpp b/src/json.hpp index 2a738269..853e6407 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -431,7 +431,7 @@ class basic_json } 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 alloc; m_value.string = alloc.allocate(1); alloc.construct(m_value.string, *other.m_value.string); @@ -500,11 +500,12 @@ class basic_json case (value_t::string): { Allocator alloc; + alloc.destroy(m_value.string); alloc.deallocate(m_value.string, 1); m_value.string = nullptr; - // delete m_value.string; - // m_value.string = nullptr; + // delete m_value.string; + // m_value.string = nullptr; break; } diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index dda0cfbd..3f6f3ab7 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -500,6 +500,7 @@ class basic_json case (value_t::string): { Allocator alloc; + alloc.destroy(m_value.string); alloc.deallocate(m_value.string, 1); m_value.string = nullptr;