summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2018-05-16 01:05:10 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-05-16 01:05:10 +0000
commit81268195886f11c529a6ca295200b80542a4539e (patch)
tree3f40c25153753db1b0de3519986c0c6f4bad0141 /tests
parent98d51d994fceb7777f93514976e215965f4befc2 (diff)
parentbf87258189b0ca6e6273cf20c27af7dfc2599ce7 (diff)
downloadextras-81268195886f11c529a6ca295200b80542a4539e.tar.gz
Merge "Fix a memory leak"
Diffstat (limited to 'tests')
-rw-r--r--tests/memtest/bandwidth.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/memtest/bandwidth.cpp b/tests/memtest/bandwidth.cpp
index aa02e66a..caccd638 100644
--- a/tests/memtest/bandwidth.cpp
+++ b/tests/memtest/bandwidth.cpp
@@ -24,6 +24,7 @@
#include <unistd.h>
#include <map>
+#include <memory>
#include <vector>
@@ -227,7 +228,8 @@ bool processThreadArgs(int argc, char** argv, option_t options[],
return false;
}
- BandwidthBenchmark *bench = createBandwidthBenchmarkObject(*values);
+ std::unique_ptr<BandwidthBenchmark> bench{
+ createBandwidthBenchmarkObject(*values)};
if (!bench) {
return false;
}
@@ -250,7 +252,6 @@ bool processThreadArgs(int argc, char** argv, option_t options[],
(*values)["size"].int_value = bench->size();
(*values)["num_warm_loops"].int_value = bench->num_warm_loops();
(*values)["num_loops"].int_value = bench->num_loops();
- delete bench;
return true;
}