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

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

commit bda7b815d011200845b576ed400f83f828e2d3de
Author: Steve Yurong Su <[email protected]>
AuthorDate: Thu Aug 5 17:57:15 2021 +0800

    [ISSUE-3690] Memory leaks on the server when cpp client invokes 
checkTimeseriesExists
---
 client-cpp/src/main/Session.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/client-cpp/src/main/Session.cpp b/client-cpp/src/main/Session.cpp
index 75713b2..71a936e 100644
--- a/client-cpp/src/main/Session.cpp
+++ b/client-cpp/src/main/Session.cpp
@@ -1019,8 +1019,10 @@ void Session::createMultiTimeseries(vector <string> 
paths, vector <TSDataType::T
 
 bool Session::checkTimeseriesExists(string path) {
     try {
-        string sql = "SHOW TIMESERIES " + path;
-        return executeQueryStatement(sql)->hasNext();
+        std::unique_ptr <SessionDataSet> dataset = executeQueryStatement("SHOW 
TIMESERIES " + path);
+        bool isExisted = dataset->hasNext();
+        dataset->closeOperationHandle();
+        return isExisted;
     }
     catch (exception e) {
         throw IoTDBConnectionException(e.what());

Reply via email to