diff --git a/ConflictSet.cpp b/ConflictSet.cpp index d9d4408..4ded851 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -3648,7 +3648,12 @@ ConflictSet::ConflictSet(ConflictSet &&other) noexcept : impl(std::exchange(other.impl, nullptr)) {} ConflictSet &ConflictSet::operator=(ConflictSet &&other) noexcept { - impl = std::exchange(other.impl, nullptr); + if (this != &other) { + if (impl) { + internal_destroy(impl); + } + impl = std::exchange(other.impl, nullptr); + } return *this; } diff --git a/HashTable.cpp b/HashTable.cpp index e3fa477..f76e8c2 100644 --- a/HashTable.cpp +++ b/HashTable.cpp @@ -119,7 +119,13 @@ ConflictSet::ConflictSet(ConflictSet &&other) noexcept : impl(std::exchange(other.impl, nullptr)) {} ConflictSet &ConflictSet::operator=(ConflictSet &&other) noexcept { - impl = std::exchange(other.impl, nullptr); + if (this != &other) { + if (impl) { + impl->~Impl(); + safe_free(impl, sizeof(Impl)); + } + impl = std::exchange(other.impl, nullptr); + } return *this; } diff --git a/SkipList.cpp b/SkipList.cpp index e0bf4e1..98d8a9b 100644 --- a/SkipList.cpp +++ b/SkipList.cpp @@ -903,7 +903,12 @@ ConflictSet::ConflictSet(ConflictSet &&other) noexcept : impl(std::exchange(other.impl, nullptr)) {} ConflictSet &ConflictSet::operator=(ConflictSet &&other) noexcept { - impl = std::exchange(other.impl, nullptr); + if (this != &other) { + if (impl) { + internal_destroy(impl); + } + impl = std::exchange(other.impl, nullptr); + } return *this; }