This is an automated email from the ASF dual-hosted git repository.
haonan 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 45b8984 [IOTDB-1289] fix CPP mem-leak in SessionExample.cpp
insertRecords() (#3963)
45b8984 is described below
commit 45b8984f339d452e375e19af809311f1118d811a
Author: Jamber <[email protected]>
AuthorDate: Tue Sep 14 21:51:05 2021 +0800
[IOTDB-1289] fix CPP mem-leak in SessionExample.cpp insertRecords() (#3963)
Co-authored-by: haiyi.zb <[email protected]>
---
example/client-cpp-example/src/SessionExample.cpp | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/example/client-cpp-example/src/SessionExample.cpp
b/example/client-cpp-example/src/SessionExample.cpp
index 943dfe7..24bb013 100644
--- a/example/client-cpp-example/src/SessionExample.cpp
+++ b/example/client-cpp-example/src/SessionExample.cpp
@@ -187,17 +187,16 @@ void insertRecords() {
vector<vector<string>> measurementsList;
vector<vector<string>> valuesList;
vector<int64_t> timestamps;
- vector<string>* values;
for (int64_t time = 0; time < 500; time++) {
- values = new vector<string>();
- values->push_back("1");
- values->push_back("2");
- values->push_back("3");
+ vector<string> values;
+ values.push_back("1");
+ values.push_back("2");
+ values.push_back("3");
deviceIds.push_back(deviceId);
measurementsList.push_back(measurements);
- valuesList.push_back(*values);
+ valuesList.push_back(values);
timestamps.push_back(time);
if (time != 0 && time % 100 == 0) {
session->insertRecords(deviceIds, timestamps, measurementsList,
valuesList);