Commit 91156107 authored by Dominik Charousset's avatar Dominik Charousset

Fix potential leak on emplace_back, close #1170

parent b9e78a66
...@@ -67,7 +67,8 @@ protected: ...@@ -67,7 +67,8 @@ protected:
workers_.reserve(num); workers_.reserve(num);
// Create worker instanes. // Create worker instanes.
for (size_t i = 0; i < num; ++i) for (size_t i = 0; i < num; ++i)
workers_.emplace_back(new worker_type(i, this, init, max_throughput_)); workers_.emplace_back(
std::make_unique<worker_type>(i, this, init, max_throughput_));
// Start all workers. // Start all workers.
for (auto& w : workers_) for (auto& w : workers_)
w->start(); w->start();
......
...@@ -89,7 +89,8 @@ message_builder& message_builder::append_from(const caf::message& msg, ...@@ -89,7 +89,8 @@ message_builder& message_builder::append_from(const caf::message& msg,
auto* meta = detail::global_meta_object(tid); auto* meta = detail::global_meta_object(tid);
storage_size_ += meta->padded_size; storage_size_ += meta->padded_size;
types_.push_back(tid); types_.push_back(tid);
elements_.emplace_back(new message_builder_element_adapter(msg, index)); elements_.emplace_back(
std::make_unique<message_builder_element_adapter>(msg, index));
} }
return *this; return *this;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment