Skip to content
Snippets Groups Projects
Commit bf3e22a7 authored by Steven Murray's avatar Steven Murray
Browse files

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

parent 8bb7cbdc
No related branches found
No related tags found
No related merge requests found
......@@ -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
}}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment