summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/session_catalog.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mongo/db/session_catalog.cpp b/src/mongo/db/session_catalog.cpp
index 614e2ed8144..24fcea6b37e 100644
--- a/src/mongo/db/session_catalog.cpp
+++ b/src/mongo/db/session_catalog.cpp
@@ -258,10 +258,11 @@ OperationContextSession::OperationContextSession(OperationContext* opCtx,
auto& checkedOutSession = operationSessionDecoration(opCtx);
if (!checkedOutSession) {
auto sessionTransactionTable = SessionCatalog::get(opCtx);
+ auto scopedCheckedOutSession = sessionTransactionTable->checkOutSession(opCtx);
// We acquire a Client lock here to guard the construction of this session so that
// references to this session are safe to use while the lock is held.
stdx::lock_guard<Client> lk(*opCtx->getClient());
- checkedOutSession.emplace(sessionTransactionTable->checkOutSession(opCtx));
+ checkedOutSession.emplace(std::move(scopedCheckedOutSession));
} else {
// The only reason to be trying to check out a session when you already have a session
// checked out is if you're in DBDirectClient.