diff --git a/client/cs_benchmark.cpp b/client/cs_benchmark.cpp index cbbc8e3cdf..2f28bee5ed 100644 --- a/client/cs_benchmark.cpp +++ b/client/cs_benchmark.cpp @@ -68,6 +68,8 @@ #include "log_flags.h" #include "client_state.h" +#include + // defaults in case benchmarks fail or time out. // better to err on the low side so hosts don't get too much work @@ -119,7 +121,7 @@ struct BENCHMARK_DESC { #endif }; -static BENCHMARK_DESC* benchmark_descs=0; +static std::vector benchmark_descs; static double cpu_benchmarks_start; static int bm_ncpus; // user might change ncpus during benchmarks. @@ -260,20 +262,21 @@ void CLIENT_STATE::start_cpu_benchmarks() { remove_benchmark_file(BM_TYPE_INT); cpu_benchmarks_start = dtime(); - if (benchmark_descs) { - free(benchmark_descs); + if (!benchmark_descs.empty()) { + benchmark_descs.clear(); } bm_ncpus = ncpus; - benchmark_descs = (BENCHMARK_DESC*)calloc(bm_ncpus, sizeof(BENCHMARK_DESC)); benchmarks_running = true; for (i=0; i