[clang] 3655de7 - [clang][Interp] Avoid a dangling pointer
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 9 01:00:18 PDT 2024
Author: Timm Bäder
Date: 2024-07-09T09:59:51+02:00
New Revision: 3655de73809b0f8f100040c4b9c9ad889dca2225
URL: https://github.com/llvm/llvm-project/commit/3655de73809b0f8f100040c4b9c9ad889dca2225
DIFF: https://github.com/llvm/llvm-project/commit/3655de73809b0f8f100040c4b9c9ad889dca2225.diff
LOG: [clang][Interp] Avoid a dangling pointer
We've just moved all the pointers from the Block to the DeadBlock,
so make sure the old Block doesn't point to a linked list of Pointers
that don't even point to it anymore.
Added:
Modified:
clang/lib/AST/Interp/InterpBlock.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/InterpBlock.cpp b/clang/lib/AST/Interp/InterpBlock.cpp
index c34ea7634b4a9..7bef5e678c074 100644
--- a/clang/lib/AST/Interp/InterpBlock.cpp
+++ b/clang/lib/AST/Interp/InterpBlock.cpp
@@ -106,6 +106,7 @@ DeadBlock::DeadBlock(DeadBlock *&Root, Block *Blk)
B.Pointers = Blk->Pointers;
for (Pointer *P = Blk->Pointers; P; P = P->Next)
P->PointeeStorage.BS.Pointee = &B;
+ Blk->Pointers = nullptr;
}
void DeadBlock::free() {
More information about the cfe-commits
mailing list