Prevent memory leak when exception is thrown in adl_serializer::to_json (#3901)

Co-authored-by: barcode <barcode@example.com>
This commit is contained in:
Raphael Grimm
2023-03-08 13:43:45 +01:00
committed by GitHub
co-authored by barcode
parent fe4b66355c
commit bbe337c3a3
15 changed files with 1321 additions and 1167 deletions
+3 -3
View File
@@ -73,9 +73,9 @@ class exception : public std::exception
{
case value_t::array:
{
for (std::size_t i = 0; i < current->m_parent->m_value.array->size(); ++i)
for (std::size_t i = 0; i < current->m_parent->m_data.m_value.array->size(); ++i)
{
if (&current->m_parent->m_value.array->operator[](i) == current)
if (&current->m_parent->m_data.m_value.array->operator[](i) == current)
{
tokens.emplace_back(std::to_string(i));
break;
@@ -86,7 +86,7 @@ class exception : public std::exception
case value_t::object:
{
for (const auto& element : *current->m_parent->m_value.object)
for (const auto& element : *current->m_parent->m_data.m_value.object)
{
if (&element.second == current)
{