summaryrefslogtreecommitdiff
path: root/typecontainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'typecontainer.cpp')
-rw-r--r--typecontainer.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/typecontainer.cpp b/typecontainer.cpp
index 3ecf6aa5..cbff21ee 100644
--- a/typecontainer.cpp
+++ b/typecontainer.cpp
@@ -80,6 +80,10 @@ TypeContainer::TypeContainer(const TypeContainer& other)
TypeContainer& TypeContainer::operator=(const TypeContainer& other)
{
+ if (this == &other)
+ return *this;
+ if (m_object)
+ BNFreeTypeContainer(m_object);
m_object = BNDuplicateTypeContainer(other.m_object);
return *this;
}
@@ -87,7 +91,11 @@ TypeContainer& TypeContainer::operator=(const TypeContainer& other)
TypeContainer& TypeContainer::operator=(TypeContainer&& other)
{
- m_object = std::move(other.m_object);
+ if (this == &other)
+ return *this;
+ if (m_object)
+ BNFreeTypeContainer(m_object);
+ m_object = other.m_object;
other.m_object = nullptr;
return *this;
}
@@ -370,6 +378,7 @@ bool TypeContainer::ParseTypeString(
if (!success)
{
+ BNFreeQualifiedNameAndType(&apiResult);
return false;
}