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

qiaojialin pushed a commit to branch rel/0.12
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/0.12 by this push:
     new a356a4a  [IOTDB-1282] fix C++ class SessionDataSet mem-leak (#3648)
a356a4a is described below

commit a356a4ae65c24f51752a20093d569fd6f5739f4a
Author: Steve Yurong Su (宇荣) <[email protected]>
AuthorDate: Fri Jul 30 02:44:41 2021 -0500

    [IOTDB-1282] fix C++ class SessionDataSet mem-leak (#3648)
---
 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();

Reply via email to