mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Fix memory leak in Json move assignment operator
* When move assignment is creates a cyclic ownership pattern memory was being leaked. This patch breaks the cycle. * Fixes: #2572
This commit is contained in:
committed by
Nik Bougalis
parent
156e8dae83
commit
157c066f2b
@@ -348,10 +348,10 @@ Value::~Value ()
|
||||
}
|
||||
|
||||
Value&
|
||||
Value::operator= ( const Value& other )
|
||||
Value::operator=(Value const& other)
|
||||
{
|
||||
Value temp ( other );
|
||||
swap ( temp );
|
||||
Value tmp(other);
|
||||
swap(tmp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -365,9 +365,10 @@ Value::Value ( Value&& other ) noexcept
|
||||
}
|
||||
|
||||
Value&
|
||||
Value::operator= ( Value&& other ) noexcept
|
||||
Value::operator=(Value&& other)
|
||||
{
|
||||
swap ( other );
|
||||
Value tmp(std::move(other));
|
||||
swap(tmp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user