You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2021/07/30 04:09:59 UTC

[iotdb] 01/01: [IOTDB-1282] fix C++ class SessionDataSet mem-leak

This is an automated email from the ASF dual-hosted git repository.

rong pushed a commit to branch iotdb-1282
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit bf1347c652251a58ac518dac73905787e5d0423c
Author: haiyi.zb <ha...@alibaba-inc.com>
AuthorDate: Wed Apr 7 12:05:12 2021 +0759

    [IOTDB-1282] fix C++ class SessionDataSet mem-leak
    
    (cherry picked from commit cea339de0fabe5a8988a80754e4efe9650bd71c8)
---
 client-cpp/src/main/Session.h | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/client-cpp/src/main/Session.h b/client-cpp/src/main/Session.h
index 62995a4..7e1a8c3 100644
--- a/client-cpp/src/main/Session.h
+++ b/client-cpp/src/main/Session.h
@@ -523,7 +523,7 @@ private:
     std::vector<std::unique_ptr<MyStringBuffer>> valueBuffers;
     std::vector<std::unique_ptr<MyStringBuffer>> bitmapBuffers;
     RowRecord rowRecord;
-    char* currentBitmap; // used to cache the current bitmap for every column
+    char* currentBitmap = NULL; // used to cache the current bitmap for every column
     static const int flag = 0x80; // used to do `or` operation with bitmap to judge whether the value is null
 
 public:
@@ -554,6 +554,13 @@ public:
         this->tsQueryDataSet = queryDataSet;
     }
 
+    ~SessionDataSet() {
+        if (currentBitmap != NULL) {
+            delete[] currentBitmap;
+            currentBitmap = NULL;
+        }
+    }
+
     int getBatchSize();
     void setBatchSize(int batchSize);
     std::vector<std::string> getColumnNames();