1
0
mirror of synced 2024-11-28 09:30:51 +01:00

patterns: Fixed multiple severe memory leaks

#163 - probably not all yet
This commit is contained in:
WerWolv 2021-02-19 10:51:30 +01:00
parent e6a08b9c18
commit 9900a51757
2 changed files with 23 additions and 0 deletions

View File

@ -188,6 +188,7 @@ namespace hex::lang {
~ASTNodeVariableDecl() override { ~ASTNodeVariableDecl() override {
delete this->m_type; delete this->m_type;
delete this->m_placementOffset;
} }
[[nodiscard]] ASTNode* clone() const override { [[nodiscard]] ASTNode* clone() const override {
@ -226,6 +227,7 @@ namespace hex::lang {
~ASTNodeArrayVariableDecl() override { ~ASTNodeArrayVariableDecl() override {
delete this->m_type; delete this->m_type;
delete this->m_size; delete this->m_size;
delete this->m_placementOffset;
} }
[[nodiscard]] ASTNode* clone() const override { [[nodiscard]] ASTNode* clone() const override {
@ -262,6 +264,8 @@ namespace hex::lang {
~ASTNodePointerVariableDecl() override { ~ASTNodePointerVariableDecl() override {
delete this->m_type; delete this->m_type;
delete this->m_sizeType;
delete this->m_placementOffset;
} }
[[nodiscard]] ASTNode* clone() const override { [[nodiscard]] ASTNode* clone() const override {

View File

@ -217,6 +217,10 @@ namespace hex::lang {
this->m_pointedAt->setVariableName("*" + this->m_pointedAt->getVariableName()); this->m_pointedAt->setVariableName("*" + this->m_pointedAt->getVariableName());
} }
~PatternDataPointer() override {
delete this->m_pointedAt;
}
PatternData* clone() override { PatternData* clone() override {
return new PatternDataPointer(*this); return new PatternDataPointer(*this);
} }
@ -453,6 +457,11 @@ namespace hex::lang {
this->m_entries.push_back(entry->clone()); this->m_entries.push_back(entry->clone());
} }
~PatternDataArray() override {
for (const auto &entry : this->m_entries)
delete entry;
}
PatternData* clone() override { PatternData* clone() override {
return new PatternDataArray(*this); return new PatternDataArray(*this);
} }
@ -528,6 +537,11 @@ namespace hex::lang {
this->m_members.push_back(member->clone()); this->m_members.push_back(member->clone());
} }
~PatternDataStruct() override {
for (const auto &member : this->m_members)
delete member;
}
PatternData* clone() override { PatternData* clone() override {
return new PatternDataStruct(*this); return new PatternDataStruct(*this);
} }
@ -609,6 +623,11 @@ namespace hex::lang {
this->m_members.push_back(member->clone()); this->m_members.push_back(member->clone());
} }
~PatternDataUnion() override {
for (const auto &member : this->m_members)
delete member;
}
PatternData* clone() override { PatternData* clone() override {
return new PatternDataUnion(*this); return new PatternDataUnion(*this);
} }