Skip to content

Commit

Permalink
fix: a potential data race lead to null pointer access
Browse files Browse the repository at this point in the history
  • Loading branch information
Swung0x48 committed Nov 29, 2021
1 parent c964817 commit 6311a9f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion BallanceMMOClient/BallanceMMOClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void BallanceMMOClient::OnCommand(IBML* bml, const std::vector<std::string>& arg
// Resolve address
auto p = parse_connection_string(props_["remote_addr"]->GetString());
resolver_ = std::make_unique<asio::ip::udp::resolver>(io_ctx_);
resolver_->async_resolve(p.first, p.second, [&](asio::error_code ec, asio::ip::udp::resolver::results_type results) {
resolver_->async_resolve(p.first, p.second, [this, bml](asio::error_code ec, asio::ip::udp::resolver::results_type results) {
std::lock_guard<std::mutex> lk(bml_mtx_);
// If address correctly resolved...
if (!ec) {
Expand Down

0 comments on commit 6311a9f

Please sign in to comment.