From 6cbdc839947fd9e13e61424f6e895751d1acf7a2 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Thu, 15 Jul 2021 12:47:15 +0200 Subject: [PATCH] :bug: fix leak for strings --- include/nlohmann/detail/conversions/to_json.hpp | 1 + single_include/nlohmann/json.hpp | 1 + 2 files changed, 2 insertions(+) diff --git a/include/nlohmann/detail/conversions/to_json.hpp b/include/nlohmann/detail/conversions/to_json.hpp index 9d7f55fc9..1b002ddb5 100644 --- a/include/nlohmann/detail/conversions/to_json.hpp +++ b/include/nlohmann/detail/conversions/to_json.hpp @@ -236,6 +236,7 @@ template::value, int> = 0> void to_json(BasicJsonType& j, const CompatibleString& s) { + j.m_value.destroy(j.m_type); external_constructor::construct(j, s); } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 7ed12f19a..601b28a06 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -4694,6 +4694,7 @@ template::value, int> = 0> void to_json(BasicJsonType& j, const CompatibleString& s) { + j.m_value.destroy(j.m_type); external_constructor::construct(j, s); }