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

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

parent b13df544
Branches
Tags
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment