Fix obvious asan warnings. (#787)

Adds a few missing overrides and removes a std::move that
prevented copy elision.
master
gaschler 2018-01-05 10:18:08 +01:00 committed by Wally B. Feed
parent 6125766c81
commit 923d643b86
7 changed files with 8 additions and 7 deletions

View File

@ -79,6 +79,8 @@ void Rpc::OnFinish() { handler_->OnFinish(); }
void Rpc::RequestNextMethodInvocation() { void Rpc::RequestNextMethodInvocation() {
// Ask gRPC to notify us when the connection terminates. // Ask gRPC to notify us when the connection terminates.
SetRpcEventState(Event::DONE, true); SetRpcEventState(Event::DONE, true);
// TODO(gaschler): Asan reports direct leak of this new from both calls
// StartServing and HandleNewConnection.
server_context_.AsyncNotifyWhenDone( server_context_.AsyncNotifyWhenDone(
new RpcEvent{Event::DONE, weak_ptr_factory_(this), true}); new RpcEvent{Event::DONE, weak_ptr_factory_(this), true});

View File

@ -58,7 +58,7 @@ class RpcHandler : public RpcHandlerInterface {
const std::weak_ptr<Rpc> rpc_; const std::weak_ptr<Rpc> rpc_;
}; };
void SetExecutionContext(ExecutionContext* execution_context) { void SetExecutionContext(ExecutionContext* execution_context) override {
execution_context_ = execution_context; execution_context_ = execution_context;
} }
void SetRpc(Rpc* rpc) override { rpc_ = rpc; } void SetRpc(Rpc* rpc) override { rpc_ = rpc; }

View File

@ -42,7 +42,7 @@ class AddFixedFramePoseDataHandler
cartographer::sensor::FromProto(request.fixed_frame_pose_data())); cartographer::sensor::FromProto(request.fixed_frame_pose_data()));
} }
void OnReadsDone() { void OnReadsDone() override {
Send(cartographer::common::make_unique<google::protobuf::Empty>()); Send(cartographer::common::make_unique<google::protobuf::Empty>());
} }
}; };

View File

@ -41,7 +41,7 @@ class AddImuDataHandler
cartographer::sensor::FromProto(request.imu_data())); cartographer::sensor::FromProto(request.imu_data()));
} }
void OnReadsDone() { void OnReadsDone() override {
Send(cartographer::common::make_unique<google::protobuf::Empty>()); Send(cartographer::common::make_unique<google::protobuf::Empty>());
} }
}; };

View File

@ -42,7 +42,7 @@ class AddOdometryDataHandler
cartographer::sensor::FromProto(request.odometry_data())); cartographer::sensor::FromProto(request.odometry_data()));
} }
void OnReadsDone() { void OnReadsDone() override {
Send(cartographer::common::make_unique<google::protobuf::Empty>()); Send(cartographer::common::make_unique<google::protobuf::Empty>());
} }
}; };

View File

@ -42,7 +42,7 @@ class AddRangefinderDataHandler
cartographer::sensor::FromProto(request.timed_point_cloud_data())); cartographer::sensor::FromProto(request.timed_point_cloud_data()));
} }
void OnReadsDone() { void OnReadsDone() override {
Send(cartographer::common::make_unique<google::protobuf::Empty>()); Send(cartographer::common::make_unique<google::protobuf::Empty>());
} }
}; };

View File

@ -36,8 +36,7 @@ class FinishTrajectoryHandler
.FinishTrajectory(request.trajectory_id()); .FinishTrajectory(request.trajectory_id());
GetUnsynchronizedContext<MapBuilderServer::MapBuilderContext>() GetUnsynchronizedContext<MapBuilderServer::MapBuilderContext>()
->NotifyFinishTrajectory(request.trajectory_id()); ->NotifyFinishTrajectory(request.trajectory_id());
Send(std::move( Send(cartographer::common::make_unique<google::protobuf::Empty>());
cartographer::common::make_unique<google::protobuf::Empty>()));
} }
}; };