Fix a nasty dangling pointer problem, due to a free'd pointer being left in
authorChris Lattner <sabre@nondot.org>
Thu, 7 Oct 2004 20:01:31 +0000 (20:01 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 7 Oct 2004 20:01:31 +0000 (20:01 +0000)
a map.  This caused problems if a later object happened to be allocated at
the free'd object's address.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16813 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/DataStructure/CompleteBottomUp.cpp

index ee111e9d8fe887c225339bfb7ab2400f385335b0..3cd2bb0eef5f7b46e5c8510da0c074664b5aeadc 100644 (file)
@@ -157,6 +157,9 @@ unsigned CompleteBUDataStructures::calculateSCCGraphs(DSGraph &FG,
     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();