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() {


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to