From 1f964c129918ad7cb02387f64e581cb8cf41754c Mon Sep 17 00:00:00 2001 From: Jordan Bayles Date: Wed, 2 Dec 2020 11:16:41 -0800 Subject: [PATCH] Fix memory leak in concrete constraints This patch fixes a memory leak found from ASAN testing. There may be more here, but this is the only one blocking our workflow. --- include/valijson/constraints/concrete_constraints.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/valijson/constraints/concrete_constraints.hpp b/include/valijson/constraints/concrete_constraints.hpp index 90a3e97..5102bfc 100644 --- a/include/valijson/constraints/concrete_constraints.hpp +++ b/include/valijson/constraints/concrete_constraints.hpp @@ -189,16 +189,16 @@ public: adapters::FrozenValue * getValue() const { - return m_value; + return m_value.get(); } void setValue(const adapters::Adapter &value) { - m_value = value.freeze(); + m_value = std::unique_ptr(value.freeze()); } private: - adapters::FrozenValue *m_value; + std::unique_ptr m_value; }; /**