From 351d3a063b458e0a84b307e91dfe503f9d97748c Mon Sep 17 00:00:00 2001
From: Sergey Yakubov <sergey.yakubov@desy.de>
Date: Mon, 12 Feb 2018 12:48:24 +0100
Subject: [PATCH] fix memory

---
 3d_party/rapidjson/include/rapidjson/reader.h | 6 ++++--
 common/cpp/include/common/error.h             | 2 ++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/3d_party/rapidjson/include/rapidjson/reader.h b/3d_party/rapidjson/include/rapidjson/reader.h
index 9b28b2685..206b26141 100644
--- a/3d_party/rapidjson/include/rapidjson/reader.h
+++ b/3d_party/rapidjson/include/rapidjson/reader.h
@@ -1223,7 +1223,8 @@ class GenericReader {
                     }
                     i = i * 10 + static_cast<unsigned>(s.TakePush() - '0');
                     significandDigit++;
-                } else
+                }
+            else
                 while (RAPIDJSON_LIKELY(s.Peek() >= '0' && s.Peek() <= '9')) {
                     if (RAPIDJSON_UNLIKELY(i >= 429496729)) { // 2^32 - 1 = 4294967295
                         if (RAPIDJSON_LIKELY(i != 429496729 || s.Peek() > '5')) {
@@ -1264,7 +1265,8 @@ class GenericReader {
                         }
                     i64 = i64 * 10 + static_cast<unsigned>(s.TakePush() - '0');
                     significandDigit++;
-                } else
+                }
+            else
                 while (RAPIDJSON_LIKELY(s.Peek() >= '0' && s.Peek() <= '9')) {
                     if (RAPIDJSON_UNLIKELY(i64 >= RAPIDJSON_UINT64_C2(0x19999999, 0x99999999))) // 2^64 - 1 = 18446744073709551615
                         if (RAPIDJSON_LIKELY(i64 != RAPIDJSON_UINT64_C2(0x19999999, 0x99999999) || s.Peek() > '5')) {
diff --git a/common/cpp/include/common/error.h b/common/cpp/include/common/error.h
index 962fe89ce..080ece577 100644
--- a/common/cpp/include/common/error.h
+++ b/common/cpp/include/common/error.h
@@ -10,6 +10,8 @@ class ErrorInterface {
   public:
     virtual std::string Explain() const noexcept = 0;
     virtual void Set(const std::string& error) noexcept = 0;
+    virtual ~ErrorInterface() = default; // needed for unique_ptr to delete itself
+
 };
 
 using Error = std::unique_ptr<ErrorInterface>;
-- 
GitLab