Remove a use after std::move

Fixes: #2538
Fixes: #2536
This commit is contained in:
Howard Hinnant
2018-11-02 11:38:18 -04:00
committed by Nik Bougalis
parent 157c066f2b
commit 146ea5d44e
2 changed files with 18 additions and 17 deletions

View File

@@ -288,6 +288,19 @@ ManifestCache::applyManifest (Manifest m)
bool const revoked = m.revoked();
if (revoked)
{
/*
A validator master key has been compromised, so its manifests
are now untrustworthy. In order to prevent us from accepting
a forged manifest signed by the compromised master key, store
this manifest, which has the highest possible sequence number
and therefore can't be superseded by a forged one.
*/
if (auto stream = j_.warn())
logMftAct(stream, "Revoked", m.masterKey, m.sequence);
}
if (iter == map_.end ())
{
/*
@@ -301,7 +314,8 @@ ManifestCache::applyManifest (Manifest m)
if (! revoked)
signingToMasterKeys_[m.signingKey] = m.masterKey;
map_.emplace (std::make_pair(m.masterKey, std::move (m)));
auto masterKey = m.masterKey;
map_.emplace(std::move(masterKey), std::move(m));
}
else
{
@@ -321,19 +335,6 @@ ManifestCache::applyManifest (Manifest m)
iter->second = std::move (m);
}
if (revoked)
{
/*
A validator master key has been compromised, so its manifests
are now untrustworthy. In order to prevent us from accepting
a forged manifest signed by the compromised master key, store
this manifest, which has the highest possible sequence number
and therefore can't be superseded by a forged one.
*/
if (auto stream = j_.warn())
logMftAct(stream, "Revoked", m.masterKey, m.sequence);
}
return ManifestDisposition::accepted;
}

View File

@@ -779,15 +779,15 @@ ServerHandlerImp::processRequest (Port const& port,
result["code"] = result[jss::error_code];
result["message"] = result[jss::error_message];
result.removeMember(jss::error_message);
r[jss::error] = std::move(result);
JLOG (m_journal.debug()) <<
"rpcError: " << result [jss::error] <<
": " << result [jss::error_message];
r[jss::error] = std::move(result);
}
else
{
result[jss::status] = jss::success;
r[jss::result] = std::move(result);
result[jss::status] = jss::success;
r[jss::result] = std::move(result);
}
}
else