From 4262be75953ca00328beba7df087b98ad9dac6ba Mon Sep 17 00:00:00 2001 From: Igor Peshansky Date: Fri, 13 Oct 2017 19:55:50 -0400 Subject: [PATCH] Add missing mutex lock. --- src/api_server.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/api_server.cc b/src/api_server.cc index 7e636b83..856c37d2 100644 --- a/src/api_server.cc +++ b/src/api_server.cc @@ -115,6 +115,7 @@ void MetadataApiServer::Handler::operator()(const HttpServer::request& request, << " body: " << request.body; if (request.method == "GET" && request.destination.find(kPrefix) == 0) { std::string id = request.destination.substr(kPrefix.size()); + std::lock_guard lock(agent_.mu_); const auto result = agent_.resource_map_.find(id); if (result == agent_.resource_map_.end()) { // TODO: This could be considered log spam.