diff options
author | Benety Goh <benety@mongodb.com> | 2020-08-01 17:06:08 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-08-01 21:19:46 +0000 |
commit | de36e2cbc7e7f38a4d2b1d017666277478ba1c7b (patch) | |
tree | 80cca55060f13ea3a8e7e4e999449468dbfb7a3d /src/mongo/db | |
parent | 7cdef9c3982206dfc2fdd3b660d4e4d6f5e5d9e9 (diff) | |
download | mongo-de36e2cbc7e7f38a4d2b1d017666277478ba1c7b.tar.gz |
SERVER-49800 fix use-after-move violations in service arch
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/repl/primary_only_service.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mongo/db/repl/primary_only_service.cpp b/src/mongo/db/repl/primary_only_service.cpp index 3ced9e74647..ed9b93b9a09 100644 --- a/src/mongo/db/repl/primary_only_service.cpp +++ b/src/mongo/db/repl/primary_only_service.cpp @@ -95,10 +95,11 @@ PrimaryOnlyServiceRegistry* PrimaryOnlyServiceRegistry::get(ServiceContext* serv } void PrimaryOnlyServiceRegistry::registerService(std::unique_ptr<PrimaryOnlyService> service) { - auto [_, inserted] = _services.emplace(service->getServiceName(), std::move(service)); + auto name = service->getServiceName(); + auto [_, inserted] = _services.emplace(name, std::move(service)); invariant(inserted, - str::stream() << "Attempted to register PrimaryOnlyService (" - << service->getServiceName() << ") that is already registered"); + str::stream() << "Attempted to register PrimaryOnlyService (" << name + << ") that is already registered"); } PrimaryOnlyService* PrimaryOnlyServiceRegistry::lookupService(StringData serviceName) { |