diff --git a/src/ripple/app/misc/impl/AMMUtils.cpp b/src/ripple/app/misc/impl/AMMUtils.cpp index 2511240bfcd..0aead02db88 100644 --- a/src/ripple/app/misc/impl/AMMUtils.cpp +++ b/src/ripple/app/misc/impl/AMMUtils.cpp @@ -314,7 +314,7 @@ initializeFeeAuctionVote( { STObject auctionSlot = STObject::makeInnerObject(sfAuctionSlot, rules); - ammSle->set(&auctionSlot); + ammSle->set(std::move(auctionSlot)); } return ammSle->peekFieldObject(sfAuctionSlot); } diff --git a/src/ripple/protocol/STObject.h b/src/ripple/protocol/STObject.h index 4bf1786cdfb..5476cd01198 100644 --- a/src/ripple/protocol/STObject.h +++ b/src/ripple/protocol/STObject.h @@ -343,7 +343,7 @@ class STObject : public STBase, public CountedObject set(std::unique_ptr v); void - set(STBase* v); + set(STBase&& v); void setFieldU8(SField const& field, unsigned char); diff --git a/src/ripple/protocol/impl/STObject.cpp b/src/ripple/protocol/impl/STObject.cpp index 1778908c489..7c546a2568e 100644 --- a/src/ripple/protocol/impl/STObject.cpp +++ b/src/ripple/protocol/impl/STObject.cpp @@ -645,23 +645,22 @@ STObject::getFieldArray(SField const& field) const void STObject::set(std::unique_ptr v) { - set(v.get()); + set(std::move(*v.get())); } void -STObject::set(STBase* v) +STObject::set(STBase&& v) { - assert(v); - auto const i = getFieldIndex(v->getFName()); + auto const i = getFieldIndex(v.getFName()); if (i != -1) { - v_[i] = std::move(*v); + v_[i] = std::move(v); } else { if (!isFree()) Throw("missing field in templated STObject"); - v_.emplace_back(std::move(*v)); + v_.emplace_back(std::move(v)); } }