mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
LayoutTypeSystem: fix memory leak
Not calling the destructor of LayoutTypeSystemNode before their deallocation was leaking pairs of Successors and Predecessors. This commit fixes it by explicitly destructing LayoutTypeSystemNodes.
This commit is contained in:
@@ -641,6 +641,7 @@ void LayoutTypeSystem::mergeNodes(const LayoutTypeSystemNodePtrVec &ToMerge) {
|
||||
// Remove From from Layouts
|
||||
bool Erased = Layouts.erase(From);
|
||||
revng_assert(Erased);
|
||||
From->~LayoutTypeSystemNode();
|
||||
NodeAllocator.Deallocate(From);
|
||||
}
|
||||
}
|
||||
@@ -675,6 +676,7 @@ void LayoutTypeSystem::removeNode(LayoutTypeSystemNode *ToRemove) {
|
||||
|
||||
bool Erased = Layouts.erase(ToRemove);
|
||||
revng_assert(Erased);
|
||||
ToRemove->~LayoutTypeSystemNode();
|
||||
NodeAllocator.Deallocate(ToRemove);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user