Skip to content

Commit 17ae6ce

Browse files
committed
Fix use-after-free in CapturePropagation
1 parent 09f1bf8 commit 17ae6ce

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/SILOptimizer/IPO/CapturePropagation.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ void CapturePropagation::rewritePartialApply(PartialApplyInst *OrigPAI,
297297
OrigPAI->getType());
298298
OrigPAI->replaceAllUsesWith(T2TF);
299299
// Remove any dealloc_stack users.
300-
for (auto *Use : T2TF->getUses())
300+
SmallVector<Operand*, 16> Uses(T2TF->getUses());
301+
for (auto *Use : Uses)
301302
if (auto *DS = dyn_cast<DeallocStackInst>(Use->getUser()))
302303
DS->eraseFromParent();
303304
recursivelyDeleteTriviallyDeadInstructions(OrigPAI, true);

0 commit comments

Comments
 (0)