diff --git a/test/cpp/end2end/round_robin_end2end_test.cc b/test/cpp/end2end/round_robin_end2end_test.cc index f4ca3baa548..796b01cd4ac 100644 --- a/test/cpp/end2end/round_robin_end2end_test.cc +++ b/test/cpp/end2end/round_robin_end2end_test.cc @@ -130,15 +130,15 @@ class RoundRobinEnd2endTest : public ::testing::Test { int port_; std::unique_ptr server_; MyTestServiceImpl service_; - std::thread* thread_; + std::unique_ptr thread_; explicit ServerData(const grpc::string& server_host) { port_ = grpc_pick_unused_port_or_die(); gpr_log(GPR_INFO, "starting server on port %d", port_); std::mutex mu; std::condition_variable cond; - thread_ = new std::thread( - std::bind(&ServerData::Start, this, server_host, &mu, &cond)); + thread_.reset(new std::thread( + std::bind(&ServerData::Start, this, server_host, &mu, &cond))); unique_lock lock(mu); cond.wait(lock); gpr_log(GPR_INFO, "server startup complete");