From a1c972df7de79c68dca2c12ba92d1018acd71c67 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 7 Oct 2004 20:01:31 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16813 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/DataStructure/CompleteBottomUp.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Analysis/DataStructure/CompleteBottomUp.cpp b/lib/Analysis/DataStructure/CompleteBottomUp.cpp index ee111e9d8fe..3cd2bb0eef5 100644 --- a/lib/Analysis/DataStructure/CompleteBottomUp.cpp +++ b/lib/Analysis/DataStructure/CompleteBottomUp.cpp @@ -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();