mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:34:57 +00:00
AK: Unref old m_data in String's move assignment
We were overridding the data pointer without unreffing it, causing a memory leak when assigning a String.
This commit is contained in:
parent
741138c585
commit
58f5deba70
2 changed files with 10 additions and 0 deletions
|
@ -181,6 +181,9 @@ String::String(String&& other)
|
|||
|
||||
String& String::operator=(String&& other)
|
||||
{
|
||||
if (!is_short_string())
|
||||
m_data->unref();
|
||||
|
||||
m_data = exchange(other.m_data, nullptr);
|
||||
return *this;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue