Commit 0386668d authored by Steven Murray's avatar Steven Murray
Browse files

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

parent 2be6befb
......@@ -59,8 +59,14 @@ ArchiveFileItor::~ArchiveFileItor() {
// operator=
//------------------------------------------------------------------------------
ArchiveFileItor &ArchiveFileItor::operator=(ArchiveFileItor &&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;
}
......
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