Fix memory leak (#124)
Fix leak occuring when parsing of a value throws an exception.
This commit is contained in:
parent
47216c8a73
commit
e557e41b05
@ -2474,7 +2474,8 @@ TOML_IMPL_NAMESPACE_START
|
||||
// get the value
|
||||
if (is_value_terminator(*cp))
|
||||
set_error_and_return_default("expected value, saw '"sv, to_sv(*cp), "'"sv);
|
||||
return { std::move(key), node_ptr{ parse_value() } };
|
||||
auto value = parse_value();
|
||||
return { std::move(key), node_ptr{ value } };
|
||||
}
|
||||
|
||||
TOML_NODISCARD
|
||||
|
3
toml.hpp
3
toml.hpp
@ -11889,7 +11889,8 @@ TOML_IMPL_NAMESPACE_START
|
||||
// get the value
|
||||
if (is_value_terminator(*cp))
|
||||
set_error_and_return_default("expected value, saw '"sv, to_sv(*cp), "'"sv);
|
||||
return { std::move(key), node_ptr{ parse_value() } };
|
||||
auto value = parse_value();
|
||||
return { std::move(key), node_ptr{ value } };
|
||||
}
|
||||
|
||||
TOML_NODISCARD
|
||||
|
Loading…
Reference in New Issue
Block a user