Skip to content

Commit 1856323

Browse files
committed
[DebugInfo] Fix memory leak in DebugSSAUpdater
Fixes an issue in commit 3946c50, PR llvm#135349. The DebugSSAUpdater class performs raw pointer allocations. It frees these properly in reset(), but does not do so in its destructor - as an immediate fix, this patch adds a destructor which frees the allocations correctly.
1 parent a4c5a74 commit 1856323

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/include/llvm/Transforms/Utils/DebugSSAUpdater.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ class DebugSSAUpdater {
235235
DebugSSAUpdater(const DebugSSAUpdater &) = delete;
236236
DebugSSAUpdater &operator=(const DebugSSAUpdater &) = delete;
237237

238+
~DebugSSAUpdater() {
239+
for (auto &Block : BlockMap)
240+
delete Block.second;
241+
}
242+
238243
void reset() {
239244
for (auto &Block : BlockMap)
240245
delete Block.second;

0 commit comments

Comments
 (0)