Skip to content

Commit a42aac5

Browse files
authored
[DebugInfo] Fix memory leak in DebugSSAUpdater (#159107)
Fixes an issue in commit 3946c50, PR #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. I'll be merging this immediately to fix the issue, but will be open to post-commit review and/or producing a better fix in a follow-up commit.
1 parent 44b686e commit a42aac5

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)