From 13d555538b2e5292560aaba12fbc52753b97f24b Mon Sep 17 00:00:00 2001 From: Vesko Karaganev Date: Fri, 4 Jul 2025 11:05:15 +0100 Subject: [PATCH] Use the provided allocator in destroy() (#4842) Uses the provided allocator to allocate the stack used to avoid recursion in the destroy() implementation used by ~basic_json. Signed-off-by: Niels Lohmann --- include/nlohmann/json.hpp | 2 +- single_include/nlohmann/json.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 3f3645524..05406ba46 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -627,7 +627,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec if (t == value_t::array || t == value_t::object) { // flatten the current json_value to a heap-allocated stack - std::vector stack; + std::vector stack; // move the top-level items to stack if (t == value_t::array) diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index b5e7417e6..cb2ca3d18 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -27749,7 +27749,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec if (t == value_t::array || t == value_t::object) { // flatten the current json_value to a heap-allocated stack - std::vector stack; + std::vector stack; // move the top-level items to stack if (t == value_t::array)