Commit 670dd0db authored by Steven Murray's avatar Steven Murray
Browse files

Protected DeletedArchiveFileItor::operator=() from self assignment and potential memory leak.

parent 7f33cae7
......@@ -60,8 +60,14 @@ DeletedArchiveFileItor::~DeletedArchiveFileItor() {
// operator=
//------------------------------------------------------------------------------
DeletedArchiveFileItor &DeletedArchiveFileItor::operator=(DeletedArchiveFileItor &&rhs) {
m_impl = rhs.m_impl;
rhs.m_impl = nullptr;
// Protect against self assignment
if(this != &rhs) {
// Avoid memory leak
delete m_impl;
m_impl = rhs.m_impl;
rhs.m_impl = nullptr;
}
return *this;
}
......@@ -87,4 +93,4 @@ common::dataStructures::DeletedArchiveFile DeletedArchiveFileItor::next() {
return m_impl->next();
}
}}
\ No newline at end of file
}}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment