From 63ae3b730a0f81222f9a79c98936b8de05b9c733 Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Wed, 27 Jan 2016 14:17:24 +0800 Subject: [PATCH] Fix memory leak --- include/rapidjson/schema.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/rapidjson/schema.h b/include/rapidjson/schema.h index 6bb3a35..e2d70c1 100644 --- a/include/rapidjson/schema.h +++ b/include/rapidjson/schema.h @@ -1505,6 +1505,7 @@ public: ~GenericSchemaValidator() { Reset(); + RAPIDJSON_DELETE(ownStateAllocator_); } void Reset() { @@ -1693,7 +1694,7 @@ private: void CreateOwnAllocator() { if (!stateAllocator_) - stateAllocator_ = ownStateAllocator_ = new StateAllocator; + stateAllocator_ = ownStateAllocator_ = RAPIDJSON_NEW(StateAllocator()); } bool BeginValue() {