From ff3eaf8963647b08d4d8e57719d20ce9743ee8cc 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. --- 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 55ec39d242..2a9c468560 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -570,7 +570,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 8e7ac2017e..0bc1c4e713 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -20673,7 +20673,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)