From 0011cd1b72db57cd5691bda2d5adf410417cb099 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Thu, 15 Jul 2021 13:12:21 +0200 Subject: [PATCH] :bug: fix leak for strings --- include/nlohmann/detail/conversions/to_json.hpp | 2 +- single_include/nlohmann/json.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/detail/conversions/to_json.hpp b/include/nlohmann/detail/conversions/to_json.hpp index 960d92e20..a0ca4211a 100644 --- a/include/nlohmann/detail/conversions/to_json.hpp +++ b/include/nlohmann/detail/conversions/to_json.hpp @@ -238,7 +238,7 @@ void to_json(BasicJsonType& j, const CompatibleString& s) { if (!j.is_null()) { - j = nullptr; + j = BasicJsonType(); } external_constructor::construct(j, s); } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 219a6a480..4bdadd871 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -4696,7 +4696,7 @@ void to_json(BasicJsonType& j, const CompatibleString& s) { if (!j.is_null()) { - j = nullptr; + j = BasicJsonType(); } external_constructor::construct(j, s); }