[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Oct 7 13:01:45 PDT 2004



Changes in directory llvm/lib/Analysis/DataStructure:

CompleteBottomUp.cpp updated: 1.14 -> 1.15
---
Log message:

Fix a nasty dangling pointer problem, due to a free'd pointer being left in
a map.  This caused problems if a later object happened to be allocated at
the free'd object's address.


---
Diffs of the changes:  (+3 -0)

Index: llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp
diff -u llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.14 llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.15
--- llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp:1.14	Sun Sep 19 23:45:25 2004
+++ llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp	Thu Oct  7 15:01:31 2004
@@ -157,6 +157,9 @@
     for (DSGraph::ReturnNodesTy::iterator I = NG->getReturnNodes().begin();
          I != NG->getReturnNodes().end(); ++I)
       DSInfo[I->first] = &FG;
+
+    // Remove NG from the ValMap since the pointer may get recycled.
+    ValMap.erase(NG);
     delete NG;
     
     Stack.pop_back();






More information about the llvm-commits mailing list