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 Grimmandbarcode authored and GitHub committed 2023-03-08 13:43:45 +01:00
1 parent fe4b66355c
commit bbe337c3a3
15 files changed
+1321 -1167

No files matched your search

+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)
{