X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=main.cpp;h=c208b2d19f381146df11e3322f86a4c34302862a;hb=26fe3ab755034ea3be8321ec0af548670f8c3bd8;hp=7022655b3c34d396a4f38405091d5b42dfdad994;hpb=a0629a862bbac969ff858d8b4c3e78bd299aa721;p=cubemap diff --git a/main.cpp b/main.cpp index 7022655..c208b2d 100644 --- a/main.cpp +++ b/main.cpp @@ -528,20 +528,20 @@ start: } // Start writing statistics. - StatsThread *stats_thread = NULL; + unique_ptr stats_thread; if (!config.stats_file.empty()) { - stats_thread = new StatsThread(config.stats_file, config.stats_interval); + stats_thread.reset(new StatsThread(config.stats_file, config.stats_interval)); stats_thread->run(); } - InputStatsThread *input_stats_thread = NULL; + unique_ptr input_stats_thread; if (!config.input_stats_file.empty()) { vector inputs_no_refcount; for (const auto &key_and_input_with_refcount : inputs) { inputs_no_refcount.push_back(key_and_input_with_refcount.second.input); } - input_stats_thread = new InputStatsThread(config.input_stats_file, config.input_stats_interval, inputs_no_refcount); + input_stats_thread.reset(new InputStatsThread(config.input_stats_file, config.input_stats_interval, inputs_no_refcount)); input_stats_thread->run(); } @@ -575,11 +575,11 @@ start: if (input_stats_thread != NULL) { input_stats_thread->stop(); - delete input_stats_thread; + input_stats_thread.reset(); } if (stats_thread != NULL) { stats_thread->stop(); - delete stats_thread; + stats_thread.reset(); } for (Acceptor *acceptor : acceptors) { acceptor->stop();